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

Re: Resolution and backtesting - Validity of backtesting and monitoring intraday systems in real time ?



PureBytes Links

Trading Reference Links

 I have right now a problem and question with this. ( TS2000i)

It has something to do with validity of TS backtesting and Ts sytem 
monitored in realtime.
I understand that the system logic will be considered by TS at the end 
of the current bar.
And that stop, reverse or entry  orders, may be executed within a bar.
My problem example is for position sizing.
In this case how do you do with intraday position sizing for example ?

Let's say we are backtesting on 30 minutes bars with a very simple 
breakout sytem of Hight and lows.
Lets' say we want to backtest a position sizing model in order to apply 
it in real time.
Let's say that the model is a Van Tharp description percent risk or 
percent volatility model which  will  risk 2% of the net equity and a 
stop level (ATR or HH, LL) to calculate the risk of the trade and define 
the number of contracts to trade.
Now problem is  : if a position is to be either exited, reversed  or 
entered within a 30 minutes bar, the system need to calculate *at that 
time*
1/ the risk to be taken for the new trade to be entered according to the 
present price and the present stop level (not the one of the close of 
the bar long minutes later or the preevious close long minutes before).
2/ Conclude the number of contracts to be entered.
3/ Buy it or sell it within the current bar ( not waiting for the close 
who might be 20 or more points further).
It cannot be acceptable that we wait for the close of a 30 minutes or 15 
minutes or 60 minutes or daily bars to re-enter  the market.

So in this case,
How do TS allows us to backtest such things ?
And how do TS allows us to apply such things in a system in real time 
intraday tarding ?
How do you personnaly backtest and really trade with position sizing 
yourself ?

I am now with exactly this problem and still do not know what to do .
My TS backtesting code takes the wrong  previous bar value of  qty to 
trade wich is often very far from the one to be traded.
So Backtesting results are wrong and system should not be traded in real 
time.
What would be the right solution with TS for this sort of cases ?

Philippe
phdesbordes@xxxxxxxxxxx
synergy@xxxxxxxxxxxxxxxx

Gary Fritz wrote:

"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 st

op 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