Australian (ASX) Stock Market Forum

Amibroker trade delays

Joined
7 June 2007
Posts
28
Reactions
0
Hi all,
I am wondering what is the difference between setting:
SetTradeDelays(1,0,0,0);
and the back test settings below. I get very different test results when using the set trade delays afl line...??
TIA...Steve C
upload_2019-12-8_17-1-24.png
 
Steve,

Info from the help file below, but first glance is that you are selling with 1 day delay in Analysis Settings and 0 days in code.

(1,1,1,1); would be more like what you are trying to do.

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 )
 
Yeah, G'day Trav...
My question suffered from being very tired at the time....
What I am trying to do is execute sells today and place new buys tomorrow to avoid the problem of not being able to place a buy order in the morning whilst waiting for an exit during the day which would mean if all funds are committed the buy is dependent on the sell.
So I thought settradedelays(1,0,0,0) would delay the buy till tomorrow. However, if I test that setting against the back test setting in my original post I get vastly different results...???
Hmm...missing something here.
 
ok Steve I would use the following settings in backtest, selecting custom opens up the below options plus it can do more in the CBT mode which I have not explored yet.

Assuming you are only looking at Long trades at this stage.

upload_2019-12-9_19-7-10.png
 
Top