- allows to control trade delays applied by the backtester
Trading system toolbox
|| SetTradeDelays( buydelay, selldelay, shortdelay, coverdelay )
|| 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:
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.
Buy = Ref( Buy, -buydelay );
Sell = Ref( Sell, -selldelay );
Short = Ref( Short, -shortdelay );
Cover = Ref( Cover, -coverdelay );
|| settradedelays( 1, 1, 1, 1 )
The SetTradeDelays function is used in the following formulas
in AFL on-line library:
See updated/extended version on-line.