I have been playing with my new TradeStation system and backtesting my trading style. I thought I would give you a taste of what I have been doing. The system lets you write a strategy in its own programming language and then apply it to a chart. Today I have done a strategy that looks for breakouts with the following characteristics:

  • Market closes at a new 60-day high
  • Range on the breakout day is 50% larger than preceding days
  • Volatility is not so high that one should keep away from the market
If there is a breakout then the system jumps into the market as soon as possible, and puts a stop loss at the closing price of the day prior to the breakout. The distance from the entry price to the stop loss is one risk unit, and the system exits when it has made one risk unit of profit. This is a low profit objective, but as I was saying last week, I have been wondering whether a breakout only gives you an entry level for a short time, and after that other factors take over. I wanted to see how often the market moves at least one risk unit in the right direction after a good breakout. The answer, according to this system applied to the S&P 500 and EUR/USD over 10 years, is about 60% of the time. 
It is not easy to define a breakout from a trading range. I won’t necessarily trade a new 60-day high — it has to be a breakout above a proper resistance level. That may render the whole analysis moot. I have been going through the charts that the system produces (example below) to see whether it trades the kinds of signals that I trade — sometimes it does and sometimes it doesn’t. Nonetheless, just playing around with it has been a good learning experience, and has increased my confidence in my technical signals.
Examples of outputs:
Here is the code, in case anyone is interested:


// Entry Inputs








// Exit Inputs







LongCond =  

Close > highest(High, NoOfBars)[1] + StdDev(Close,30)*CloseOverHL

and truerange > average(truerange,RangeNo)[1]*RangeIncrLong

and Close > Open

And StdDev(close,5) < StdDev(close,60)*StdDevDanger;

ShortCond = 

Close < lowest(Low, NoOfBars)[1] – StdDev(Close,30)*CloseOverHL

and truerange > average(truerange,RangeNo)[1]*RangeIncrShort

and Open > Close

And StdDev(close,5) < StdDev(close,60)*StdDevDanger;

If LongCond then begin

Buy (100/((high-truerange*1/3) – Close[1])) shares next bar at market;

Stoploss = ((high-truerange*1/3) – Close[1]);


If ShortCond then begin

Sellshort (100/(Close[1] – (Low+truerange*1/3))) shares next bar at market;

Stoploss = (Close[1] – (Low+truerange*1/3));