[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resolution and backtesting



PureBytes Links

Trading Reference Links

"Henry Amand" <h.amand@xxxxxxxxx> wrote:
> Tradestation will alway's deside what it will
> do on the end of a bar and not within the bar.
> 
> Imagine that you would trade an MA crossover
> system. During the 15 minutes of building the bar
> it might very well be that the first minute the MA is
> crossed and the second minute it is below again. ...
> So trading within a bar is not what TS will do. 

Henry is right, but let me clarify a bit.

* TS *does* obviously handle trades within a bar if you have set 
stop orders in the previous bar.  The instant that the price is 
hit, the order is filled.

* Your system logic runs only at the close of the bar.  So if you 
make buy/sell decisions in your code, e.g. an MA crossover system 
like Henry mentions, that code can only buy/sell/exit at the 
close of the bar, no matter how often the MA crosses while the 
bar is building.

* Neither of those cases apply to the original question, which 
asks about the backtesting resolution option.  When your system 
uses stops, TS knows the stop was hit if it falls between the H 
and L of a bar.  If there is only one stop in the bar, there is 
no ambiguity.  However if you run very tight stops -- say you 
have both a trailing stop and a profit target that fall within 
the range of a single bar -- then which stop was hit first?  Did 
you hit your profit target, or did it hit your trail?  There is 
NO WAY to know for sure if you have only the OHLC of the bar.  By 
default TS will make some guesses based on the bar -- so (if I 
remember right) if C > O then TS assumes the price went directly 
from O to L to H to C, and vice versa if C < O.  That isn't 
always accurate.  By turning on the backtest resolution, you can 
have TS track the price action **within** the bar, so the stops 
get hit in the proper order.  Obviously you must have finer-
resolution data for TS to examine for this to work -- maybe you 
built your EOD bars out of 10min data, or your 5min bars out of 
tick data.  This ONLY applies to stops, since (as I said above) 
your system code won't get executed until the close of the bar.

Gary