• Australian (ASX) Stock Market Forum

Hello and welcome to Aussie Stock Forums!

To gain full access you must register. Registration is free and takes only a few seconds to complete.

Already a member? Log in here.

Amibroker trade delays

Discussion in 'Trading Strategies/Systems' started by stevecar144, Dec 8, 2019.

  1. stevecar144

    stevecar144

    Posts:
    28
    Likes Received:
    0
    Joined:
    Jun 7, 2007
    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
     
  2. Trav.

    Trav.

    Posts:
    640
    Likes Received:
    733
    Joined:
    Nov 27, 2017
    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 )
     
  3. stevecar144

    stevecar144

    Posts:
    28
    Likes Received:
    0
    Joined:
    Jun 7, 2007
    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.
     
  4. Trav.

    Trav.

    Posts:
    640
    Likes Received:
    733
    Joined:
    Nov 27, 2017
    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
     
Loading...

Share This Page