Money Management Trading Systems Day Trading & Scalping Developing a Trading Strategy Part 2

In the first part of this article, which can be read here, we looked at choosing an instrument and timeframe to trade, as well as establishing the set-up and entry rules. In the second and final part we will consider how to establish exit rules as well as various filters and money management rules to maximise the profitability of the system.

6. Stop Loss Rules.

Our strategy already has a natural stop loss in the stop order that does not get filled. The objective of the strategy is to capitalise on those days where the high or low for the day is in place early (9.30-11.45am). If we enter a trade on a breakout of either the high or the low and then the market subsequently hits the other stop we know that our trade is invalid. We know from our testing earlier that this only occurred 10% of the time.

We could add additional rules for the stop loss such as:
  • Moving the stop to breakeven when we are a certain amount in profit. However, how or why would the market care where our breakeven point is?

  • Trailing the initial stop loss as the trade moves into profit.

  • Having a fixed maximum stop (say 35 pts). Fixed point values should be avoided, they do not take into account changes in market volatility and do not "future proof" the system.

  • Setting the stop at a percentage of the opening range. The theory being that if the market has retraced a certain amount then it is likely to continue and eventually hit our original stop.

  • The opening range that we have concluded produces the best system expectancy over our test period, can be relatively wide, averaging 62% of the days range. So, if the days range is 200 points our stop would be 124 points on average. Many traders prefer a much tighter stop for psychological reasons. However, as we discovered with the opening range, there is a payoff between a tighter stop loss and a lower winning percentage.

Let's examine results based on setting the stop loss at a percentage of the opening range. Assume that the trade is closed at 4.00pm ET if not stopped:
Stop as a %age of opening range%age stoppedAverage loss on stopped trades%age not stoppedAverage profit on trades not stoppedExpectancy per trade
10% 84%6.5316%44.410.95
20%74%12.3526%36.790.59
30%58%18.1942%29.702.26
40%50%24.2650%27.051.73
50%41%28.7659%23.451.53
60%31%35.1869%23.515.60
70%25%40.3075%20.355.14
80%21%44.0479%18.434.92
90%16%45.7684%15.806.33
100%11%48.0089%13.156.42

Expectancy per trade is calculated as (%W*Av W)-(%L*Av L)

The above table is based on 109 trades being triggered over the 124 day test period.

We can clearly see a payoff - as the average loss is reduced by having a tighter stop, the percentage of losing trades increases. With a stop at 20% of the opening range we have an average loss of only 12 points and an average win of 37 - A risk/reward ratio than many traders would like at 1:3. However we are stopped out 74% of the time giving an average expectancy of less than 1 point.

Leaving the stop at the opposite side of the entry range means we are only stopped out 11% of the time for an average loss of 48 points. However, the average profit on the remaining 89% of trades is only 13 points. Many traders would be wary of a risk/reward ratio of 3.5:1 but the much better percentage of trades which are not stopped out at 89% means an average profit per trade of 6.42 points.

In conclusion, it is essential to examine the interaction between percentage winners and losers as well as the average win and average lose. We cannot consider the risk/reward ratio without also checking the percentage of winning trades.

We will continue to hold our stops at the opposite side of the opening range.

7. Profit Taking Exits.

At the moment our only profit taking exit rule is to
close at the end of the day, quite simply because we are developing a day trading system with no overnight risk. Generally on a strongly trending day (the type we are aiming to capture) the market will close at very near the high/low for the day so closing the trade at the market close makes sense.

However, there are days where the market will break one way or the other and then stage a reversal before the close. If we are waiting until the end of the day to close we may find that our trade moves substantially into profit before reversing and giving that profit up.

The most common profit taking exits are:
  • A trailing stop
  • A target

Let's examine both of these concepts in regards to our Dow system, starting with a trailing stop. Rather than leave our stop at the opposite extreme of the opening range we'll trail it behind the market - if we are 10 points in profit then our stop will move 10 points. Of course, the trailing stop can only move in our favour, we should never move it further away.

Trailing the stop behind the market produces a net profit of 5.55 points per trade, compared to 6.50 when we did not trail it. On this particular system, trailing the stop seems to be inferior to leaving the stop alone.

How about setting a target? In order to future proof our system we should ensure that the target is a function of current market volatility. Therefore we'll use a percentage of the opening range as a target.
Target as a %age of opening range%age where target hitAverage profit where target hit%age where target not hitAverage profit on trades where target not hitExpectancy per trade
10%88%6.4712%(19.00)3.43
25%72%15.2628%(20.29)5.15
50%45%28.2955%(17.57)3.05
100%21%51.3079%(8.03)4.49
150%9%73.0091%(3.11)3.87
200%6%91.6794%0.505.52
250%3%116.0097%2.615.73
300%1%108.0099%5.096.03
No target0100%6.426.42

By setting a target we aim to increase the winning percentage, the trade-off is that we reduce the average winning profit. We can see that setting a tight target at just 10% of the opening range gives us 88% of trades where the target is hit. Which psychologically is great, we're winning almost 9 times out of every 10 trades. Unfortunately, our average win is just 6.47 points against an average loss of 19.00 points on the 12% of trades that do not hit the target.

Setting a target has reduced the performance of our system, we will continue to hold trades until the close.

8. Ways To Improve The Profit Per Trade.

There are two ways to improve the profit per trade:
  • Increase the profit from the winning trades or reduce the losses from the losing trades - which is what we were trying to achieve through the use of stops and targets in the previous sections.
  • Decrease the number of losing trades through the use of filters - which is what we will examine in this section.

Three ideas for a filter system could be:
  • Seasonal factors - does the system perform better or worse on a particular day of the week?
  • Markets will often consolidate the day after a large range expansion, do we want to avoid these days?
  • Should we only take signals in the direction of the current trend?

Firstly, let's look at the results that we get by the day of the week:
Weekday Number of trades Win %age Average Win Average Loss Expectancy per trade
Monday 1953%392110.47
Tuesday2646%44256.77
Wednesday 2357%522418.83
Thursday2232%2632(13.32)
Friday 1958%32209.74

Each day is reasonably consistent, except Thursday. Thursday has the lowest percentage of winners (at 32%), the lowest average win (26 points), the highest average loss (32) and actually makes a loss per trade. It has to be pointed out that our sample sizes for the individual days is quite low at around 20, but Thursday is overwhelmingly poor.

By not trading on Thursday we would raise our overall expectancy per trade to 11.41 from 6.42.

Secondly, when the market makes a relatively large move it will tend to pause and consolidate. Our breakout system will want to avoid days where the market is likely to consolidate. Let's say we won't trade when the actual trading range the day before was more than x times the average actual trading range for the previous 5 days. The actual trading range is defined as the difference between the high (or the previous close if it is higher) and the low (or the previous close if it is lower). We will test various values of x:
Value of X Number of Trades Win %age Average Win Average Loss Expectancy per trade
1.16543%43235.38
1.2 7145%44237.15
1.3 8246%44256.74
1.4 8648%43257.64
1.5 9149%42257.83
1.6 9651%42259.17
1.79952%41268.84
1.8 10151%40267.66
1.9 10450%40257.50
2.0 10750%40257.50
2.5 10949%40266.34

We can see that if the previous day's actual trading range is 1.6 or more times the average for the previous 5 days then by not trading we will increase the winning percentage from 49% to 51%, increase the average win from 40 points to 42 points and cut the average losing trade from 26 to 25 points - increasing the expectancy per trade to 9.17 points.

Thirdly, another popular filter is to only take trades in the direction of the current trend. We could define the current trend, quite simply, as taking the difference between the latest closing price and the closing price from x days ago. If the latest close is higher then the trend is up and we will only take long trades, if it is lower then the trend is down and we will only take short trades. Let's test for various values of x, i.e. taking the close from x days ago.
X days Number of Trades Win %age Average Win Average Loss Expectancy Per Trade
1 5746%49259.04
2 5042%45273.24
3 5545%50268.20
4 4842%57268.86
5 6040%47263.20
No filter 10949%40266.34

There are two problems with these results:
  • If we take our directional indicator as 1 day, 3 days or 4 days we improve our expectancy per trade, but if we take 2 days or 5 days we reduce it substantially. This inconsistency suggests the filter may not be too reliable for out of sample data.
  • The number of trades taken is halved for a relatively small increase in expectancy, if we take 1 day as being the best value. Trade frequency is important and if we half the number of trades we would want to more than double the expectancy to compensate.

For these reasons I would not include a directional filter as defined above in our system.

Overall we have now added two filters to our system:
  • We will not take any trades on a Thursday.
  • We will not take a trade if yesterday's average trading range is more then 1.6 x the average of the previous 5 day's average trading range.

The overall effect is:
Number of Trades Win %age Average Win Average Loss Expectancy per Trade
Without Filters 10949%40266.34
With Filters 8054%432312.64

By using the two filters we cut out 29 trades which helps to increase our win percentage from 49% to 54%, average win to 43 points from 40 points and reduce our average loss from 26 points to 23 points. Overall our expectancy per trade doubles from 6.34 points to 12.64.

9. Money Management Rules

Once we have developed the actual trading rules there is one further, important, consideration - how much to risk on each trade. Good money management serves two purposes:
  • Minimises the risk of losing the whole trading account before the system edge has a chance to work out.
  • Maximises the potential of the trading system when conditions are favourable.

Many traders will, mistakenly, try to minimise their risk by setting tighter stop levels. Stop levels should, actually, be set as a function of market action. If the losses taken when those stops are hit are unacceptable to us then we should reduce the number of contracts traded, rather than merely tighten the stop. As we have seen this course of action is likely to lead to increased losing trades and an overall degradation of the system performance. In other words, money management controls risk not stop orders.

In order to establish money management rules for our system we need to examine how it has performed over our test period:

Test Period:​
January - June 2004

Total Points Profit:​
1012

Total Trades:​
80

Allowance for Slippage/Commission
(3pts per trade):​

(240)

Net Profit:​
772

Maximum Draw down:​
181

For money management we are most interested in the maximum drawdown. The mini-Dow trades at $5 per point so the maximum draw down on 1 contract was 181 x $5 or $905. In order to trade through this period with one contract we would have needed a minimum of $905 plus the minimum account balance requirement (for Interactive Brokers) of $2,000 = $2,905.

However, future performance of the system is unlikely to replicate our test period so for this reason we must be rather more conservative. Remember our objectives with money management - minimise the chances of losing everything whilst maximising the potential.

If we double our historical maximum drawdown of $905 and add on the minimum account balance requirement of $2,000 we get $3,810. So, if we begin trading 1 contract with $4,000 in our account we would need to immediately start a losing sequence which is twice as big as the maximum during our testing period in order to not be able to continue trading the system. A situation which could, of course, happen but is reasonably unlikely.

The risk per trade may seem very high, if our stop is 50 points or $250 then we are risking 6.25% of our account where many books will recommend just 1%. However, remember our objective with money management is to maximise the potential of our system. The only way to do that with a small account size is to increase risk to the limit of acceptability - we have shown that even at this higher level of risk we are unlikely to lose the whole account. If we were to risk only 1% then we would need at least $25,000 to trade just 1 contract, which given our maximum historic draw down of only $905 is blatantly over the top.

Once we have established the minimum required to begin trading the system we should look at how we will increase the number of contracts traded as the account balance grows. There are 2 main variations:

Fixed Fractional. Here we will trade 1 contract for every $x in the account. In our example that is 1 contract for every $4,000. So at $8,000 we will trade 2 contracts, at $12,000 3 contracts and so on. Note, that if the account balance drops back below the threshold we will drop a contract. In summary:

Account balance required:
Contracts:
4,000​
1​
8,000​
2​
12,000​
3​
16,000​
4​
20,000​
5​
24,000​
6​
28,000​
7​
32,000​
8​
36,000​
9​
40,000​
10​

We can continue to trade 1 contract below $4,000 down to the account minimum of $2,000 as established earlier.

Fixed Fractional is a popular method of money management however it has a serious flaw. That is, it requires unequal achievement at different contract levels. To move from 1 contract to 2 we are required to make a profit of $4,000 from trading 1 contract. However, to move from 2 contracts to 3 contracts we still require $4,000 of profit but this time from 2 contracts. This means that small account balances will take time to grow and for larger account balances the number of contracts traded will jump wildly around. It is not suited to either small or large accounts!

Fixed Ratio: Resolves the problem of fixed fractional by adding a variable to the calculation. This variable (or delta) is the amount required per contract to move to the next level. The lower the delta the more aggressive the system will be.

The formula is:
equity required to trade previous contract size + (number of contracts x delta) = Next level.

If we use $4,000 as our base level for 1 contract and a delta of $1,000 we get:

Account balance required:
Contracts:
4,000​
1​
5,000​
2​
7,000​
3​
10,000​
4​
14,000​
5​
19,000​
6​
25,000​
7​
32,000​
8​
40,000​
9​
49,000​
10​

Comparing the tables shows that at lower account balances the risk is higher (we can trade more contracts) but as the account grows the risk is reduced. For example with an account balance of $10,000 we would be trading 4 contracts against only 2 for fixed fractional. For an account balance of $40,000, though, we will only trade 9 contracts against 10 for fixed fractional. If the account falls below $4,000 we will continue to trade just 1 contract with both methods.

Fixed fractional allows us to be aggressive with a small account and reduce the risk as the account balance grows.

10. Conclusion.

Over the course of this article we have developed a trading system for the mini-Dow Jones futures contract using data from January 2004 to June 2004. Starting with a basic idea for trading an open range breakout we have tested and added each component of the system in a methodical manner. It is important to realise that our system has been created using specific data and is optimised for that particular data set. If we have "over optimised" then we will find that when we test using other periods the system will fall apart. Signs of an over optimised system are:
  • Lots of different parameters
  • Very specific values for the parameters. i.e. a value of 47 makes a profit but 46 or 48 don't.
  • Different parameter values for different markets or even periods
  • Using fixed values - i.e. a fixed 35 point stop no matter what the current market volatility.
  • The system makes a spectacular profit over the testing period and a spectacular loss the rest of the time!

Let's recap our system to make sure it doesn't look too optimised:
Market:Mini Dow Jones $5 futures contract
Set-up:Trading Range 9.30am - 11.45am ET
Entry:Long on a break of the high, short on a break of the low of the opening range.
Stop Loss:The opposite entry point.
Exit:Stop hit or 16.00 ET.
Other rules:Do not trade on Thursday.
Do not trade if previous day's
average trading range > average previous 5 days.

Our set-up contains a specific value for the opening range - 135 minutes. However we tested around this value and anything between 45 minutes and 180 minutes made very little difference overall.

Not trading on Thursday is a very specific rule and could be optimised for our test dataset.

Out of Sample Data

The final test for the system is to check the performance on out of sample data. Here are the results by month after allowing 3 points for slippage and commission.
QuarterNet Points Trades Per Trade
Jan - Mar 20033933910.08
Apr - Jun 2003210365.83
Jul - Sep 20033873810.18
Oct - Dec 2003214415.22
Jan - Mar 2004416429.90
Apr - Jun 20043593510.26
Jul - Sep 200460431.40
Oct - Dec 2004215375.81

As expected our sample period of Jan - Jun 2004 does produce good results, however we also experience similar results for the 1st and 3rd quarters of 2003 suggesting that the system is not over optimised for one particular period.

Draw down

During our test period we experienced a maximum draw down of 181 points, this is exceeded 4 times during our larger back test:
DatePoints
19 Feb 03234
10 Jun 03254
19 Aug 03215
27 Sep 04189

These are all acceptable as in our money management section we allowed for 2 x 181 points or 362 points for maximum draw down.

Equity Curve

Finally, a quick look at the equity curve for trading a single contract below shows that the system is fairly consistent over the entire period:

Equity Curve


Money Management

Trading a single contract makes 2,254 points profit ($11,270) over the 2 year period. Earlier we established a fixed ratio money management model based on our test data. Using this model to trade the system over the 2 year period, turns a starting balance of $4,000 into $47,785, a profit of $43,785. In this case the equity curves looks like:

Equity Curve


Finally

In this article we have examined stage by stage the development of a single trading system using as an example the mini-Dow Jones futures contract. We have produced a system which is consistent and which over the past 2 years would have produced a reasonable profit, especially if aggressive money management is used.

It should be noted that over these 2 years the Dow Jones index has experienced very low volatility when compared to previous years making it a fairly difficult time for day trading systems. However, the currency markets have been volatile over this period and we could have chosen to develop a system to trade dollar/euro or dollar/pound futures, which would have been far more profitable. The point of the article was to demonstrate a systematic approach to system development using an instrument that people are familiar with.

Reliance should not be placed a one system alone. A number of different systems should be developed (using the above methodology) using different instruments, timeframes and set-ups (both trend following and counter-trend). In the last year currencies have been more volatile than indexes whereas in 2002 the opposite was true. All systems have good periods and bad periods and by diversifying the systems traded we can substantially reduce the overall draw downs and produce much smoother equity curves.
 
Last edited by a moderator:
Well it looks as though I took the right couple of weeks off on vacation - both weeks lost money for the example trading system.

Over the last 2 weeks EMD made a profit of $410 but NQ, EMD, ES and NQ lost $340, $390, $862.50 and $1,265 respectively.

Anyway, I will be updating the daily results page everyday again from now on, so let's hope things improve!
 
sidinuk said:
Well it looks as though I took the right couple of weeks off on vacation - both weeks lost money for the example trading system.

Over the last 2 weeks EMD made a profit of $410 but NQ, EMD, ES and NQ lost $340, $390, $862.50 and $1,265 respectively.

Anyway, I will be updating the daily results page everyday again from now on, so let's hope things improve!

If i'm looking to the results of the past 3 moths it shows not verry good. Most of the times the entering is good..and most of the times afther taking in a position..the markets are moving to the good sight. Either the exit strategie doesn't wordk verry well for this moment. Arn't you looking for a better exit strategie for the moment?

Grz.
 
Hi Eddy Bull

Your right, the results are mediocre at the moment and the actual results from January 2005 are not as impressive as the hypothetical results for the previous 2 years. I do not intend to alter the system at all as monitoring the actual results against the original system is really part of the experiment. There are certainly many things that could be done to improve the results and the system is presented as a starting block for others to build upon and customise for themselves.

This is a good reason to develop a basket of systems using different methods rather than relying on one system alone.
 
Tim et al

I have done quite a lot of work on this system - along with others.
Nothing I found really improves it dramatically RSI looked to be useful but resulted in too few trades.
Trading with the master trend has some possibilities ( a "buy easier" or "sell easier" day concept) but I haven't finished the work there yet.
What really helps is just observing the breakouts - I find quite often I miss out on the big losers - taking say 5 ticks or so loss just by observation.
Especially this month where the breakout has sometimes only been a tick or two.
I hate this because I like the idea of mechanical trading!

The biggest plus though was doing away with ES and NQ and adding the DAX.
However the DAx has two heads - a morning one and an American one so be cicumspect!

ES/NQ are just different animals and, if anything, Sid clearly demonstrated they really don't add anything to the portfolio (my view)

The most fascinating research area though has been playing with position sizing and money management.
I turned Sid's performance into stellar amounts - all according to standard "rules".
This year the account went up 85%.(from Feb 16)... and then fell right back to zero in 4 weeks flat ( this is based on the standard system).
Experiencing this in "real time" I would recommend to anyone - its humbling.

To summarize -
1. Sids' system is very educational and well thought through
2. its not going to make you rich quick.
3.Work through it and like me you end up in the same place but at a slightly different angle (darksiders will love that comment)
4. Coding it revealed all sorts of Tradestation quirks that I didn't know about - again highly useful. So my results only bear passing resemblance to Sid's as I got fed up altering the data inputs on a daily basis eg yesterday I did NOT have a Range filter on ER2 whereas Tim did. So I record a loss of 2.1 points.
Generally this is very rare though.
5. I would love to hear from other people who have played about with this strategy.
 
The original system had a mixed week last week. A good day on Wednesday ($1,517.50 profit for trading 1 contract of ES, NQ, ER2, EMD and YM) was offset on Friday with a loss of $1,422.50. Friday's loss was many down to short positions on ER2 and EMD although overall these two contracts continue to outperform the bigger cap indexes.

Click here to check the latest results daily
 
rdstagg,

Great to see the work you've put into making this a better system. Interesting to see that you find the Dax a good performer, what times did you find worked for the opening range and closing?
 
I use 1015 breakoout.
I tested just being mechanical but I do find that the character of the trend can change mid stream (as it were) when big news/figs come out of the states.
So in my own trading I apply a little discretion!!

Edit - so that means most times its 1900 close but I will trail a stop if say non farm payrolls are coming out and I have a healthy profit.
 
Hi there,

I like the idea of keeping the system simple but then spreading it out over different markets. This year it hasn't performed too well for indexes since volatility is low - has anyone tried and tested it on higher volatility markets such as currencies? I'd so it myself, I just don't have the technical possibilities right now. Thanks!
 
Samurai,

It's difficult to transfer this system directly to the currency markets because the currency markets are 24 hour markets. Of course, the emini index futures trade 24 hours but they are really only liquid during the stock market opening hours.

It is,however, possible to devise profitable day trading breakout systems for currencies based on the open of the London markets at around 8am GMT or US markets at 1.30pm.

The currency markets have lost quite a bit of volatility this year as well, certainly compare to this time last year when there were loads of forex breakout systems being touted!
 
The example day trading system had a mixed week last week. On Wednesday the system made £1,527.50 on the 5 contracts but this was offset by a reversal on Friday.

EMD (lost $510) and ER2 (lost $320) were the worst performing contracts over the week, whereas YM managed to make £370.

The system has begun this week with 2 profitable days on Monday and Tuesday.
 
The example day trading system made a profit of $312.50 over the 5 contracts, before commissions last week. Although we saw mixed performance, a gain of $1,090.00 on Tuesday was wiped out by a loss of $1,115.00 on Wednesday.

EMD (lost $300) and ER2 (lost $90) were, again, the worst performing contracts over the week, whereas ES managed to make £312.50 to be top performer.
 
The example day trading system made a profit of $1,882.50 over the 5 contracts, before commissions last week. Good gains on Monday ($1,662.50) and Wednesday ($1,957.50) seeing us through.

EMD (made $800) and ER2 (made $750) were the best performing contracts over the week, whereas YM managed to lose $130.
 
bodemloze_put said:
Did you skip 1 week because it was such a desastrous week (minus $3700)?
Eeek, thats a big loser. Has this system made money overall since forward testing began
in january?
 
bodemloze_put, yep your right, I had the flu last week and didn't post any comments - Of course I might have had more energy if it had made $3700 rather than lose it!!

Basically, Wed 24 Aug, gave us a big reversal which caught the system long on all the indexes with a large opening range. It wasn't the worst week in backtesting history - that dubious honour goes to w/e 14 May 2004 where a loss of $5,542.50 was recorded. So it was well within historic testing parameters. Remember, these losses are across 5 contracts.
 
The online trading system made a profit last week of $937.50 over the 5 contracts that we monitor, before commission costs. 11 winning trades out of 13 with the average winner being $87 and the average loser at $10. EMD (gained $330), YM (gained $245) and ER2 (gained $220) top performed whereas NQ (lost $20) was the worst performing contract.
 
After a couple of winning weeks the system had a losing week last week, although it was a little mixed.

NQ (up $110) and ER2 (up $50) were profitable but YM (down $300), ES (down $550) and EMD (down $660) turned in losers for the week.
 
Easy Language Code

Hello,

I know that the system code for TradeStation 8 has already been posted. Since the Author is no longer availabe via e-mail, I wonder if someone else could modify the code for TS2000i with the following changes: Volatility and thursday check should be skipped: I would like to have a strategy which is active on all trading days.

Thanks in Advance!
 
Ts8 code and author

Bounty one

The author is definitely still here!
Here's the code for 2000i.

Its very basic like this.
Rgds

{ **** Mini Dow Jones Range Breakout system v4 Sept 2005 ***************************
Original design by Sidinuk - www.online-futurestrading.com
Code - Russell Stagg [[email protected]]

DATA1 Symbol YM(H)05.D 1 or 5 min chart - NB not full Globex session
DATA2 Symbol YM(h)05.D Daily chart AT LEAST 4 MONTHS WORTH OF DATA REQUIRED{No Longer required for this version}
Change Log:
Feb 05 Added filter switch to Input variable.
Set maxbarsback to 50.
}
Input:{All times are UK(GMT)} OR_Time(1645),Endtime(2100),ShowLines(true),Show_nos(true),Txt_displace(100),Break_points(1);

Var: n(1),Trade_Flag(true),PLot_hi(0),Plot_lo(0),maxbarsback(50);
Var:{Text variables} Low_line(-1),OR_Bar(-1),Hi_Line(-1),Hi_no(-1),Lo_no(-1), Decimals(1);

{Position Sizing Algorithm}
N = 1;

{Open Range Plot Variables}
{ if Session(0) <> Session(0)[1] and barstatus(1) = 2 and Session(1) <> -1 then begin }
if barstatus(1) = 2 and date <> date[1] then begin
Plot_hi = 0;
Plot_lo = 0;
Trade_Flag = true;

end;

if time = Or_time then begin
Plot_hi = Highd(0);
Plot_lo = lowd(0);

{Draw Lines}

if ShowLines then begin
Hi_line = TL_new(date,time,Plot_hi,date,endtime,Plot_hi);
Tl_setstyle(Hi_line,tool_dashed2);
Low_line = TL_new(date,time,Plot_lo,Date,endtime,Plot_lo);
Tl_setstyle(Low_line,tool_dashed2);

end;
{Text}
if Show_nos then begin
Hi_no = Text_new(Date,time-txt_displace ,Plot_hi ,numtostr(Plot_hi,decimals));
Lo_no = Text_new(Date,time-txt_displace,Plot_lo ,numtostr(Plot_lo,decimals));
end;
end;


{Exits & Stops}
if marketposition <> 0 then begin
Trade_flag = false;
end;
{Entries}
If Trade_Flag and time >= or_time and time < endtime then begin
if marketposition = 0 then begin
Buy("++") n contracts next bar at (Plot_hi + 1 point) stop;
Sell("XX") n contracts next bar at (Plot_lo - 1 point) stop;
end;
end;

{Short Exits}
if marketposition = -1 then begin
if time = Endtime then exitshort("Time") n contracts next bar at open;
exitshort ("Stop") n contracts next bar at Plot_hi + 1 point stop;
end;
{Long Exits}
If marketposition = 1 then begin
exitlong (" Stop") n contracts next bar at Plot_lo - 1 point stop;
if time = Endtime then exitlong(" Time") n contracts next bar at open;
end;

{E & OE}
 
Last edited:
Top