SetTradeDelays
- allows to control trade delays applied by the backtester

Trading system toolbox
(AFL 2.1)


SYNTAX SetTradeDelays( buydelay, selldelay, shortdelay, coverdelay )
RETURNS nothing
FUNCTION Sets trade delays applied by the backtester. This function allows you to override trade delays from the "Settings" page. It is important do understand what trade delays really do. They in fact internally apply the following:

Buy = Ref( Buy, -buydelay );
Sell = Ref( Sell, -selldelay );
Short = Ref( Short, -shortdelay );
Cover = Ref( Cover, -coverdelay );
inside backtester after your formula is executed but before backtester starts trade simulation. It is functionally equivalent to having above 4 lines at the end of your formula. Note that NO OTHER variables are affected by trade delays, therefore for example if your position sizing depends on values found in buy/sell/short/cover variables *and* if you are using non-zero trade delays you need to account for that in your code.
EXAMPLE settradedelays( 1, 1, 1, 1 )
SEE ALSO  

References:

The SetTradeDelays function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference