Multiple orders in 1 candle

Forums ProRealTime English forum ProOrder support Multiple orders in 1 candle

Viewing 8 posts - 1 through 8 (of 8 total)
  • #60127

    Hi:

    I have a problem in which the back-test takes multiple orders in one bar. Mt system is a pyramiding strategy that takes additional positions every time price goes up by 2ATR however, it seems to take on multiple orders on the same bar every time there is a large candle and/or ATR goes up significantly. From the code, it should be taking one position per candle only.

    Can anyone tell me what’s wrong? Thank you.

    Ruben

    #60129

    Because all the conditions for a new order to open are exactly the same: Close>open+ATR (same Open, same Close and same ATR).

    #60156

    Not quite because there is no problem on the previous 3 transactions (in the attachment). It happens on other instruments as well, the code works well unless there is a large candle, it is only on the large candles that it does this, it executes multiple orders at exactly the same price. However, from the code, it should be recording the close of the candle as a reference for the next transaction. It should also be processing every candle only once.

    Even if all conditions were the same you would see trades on every candle, not multiple transactions on the same candle at the same price. The IF/ENDIF conditions should prevent that shouldn’t it?

    Here’s the code.

    Has anyone seen this before? Thanks in advance

     

     

    #60161

    Yes , it appears on large candle, when the Close is superior to previous “BuyPrice” with 2 ATR, so it never happens on small candle (because ATR is small).

    The problem is that each time you open an order you increase the “transactions” variable and this is the only variable tested to open a new order (because your Close>Buyprice+ATR*2 condition is always the same) and since the code is read from to to bottom, you add continuously new order (from line 32 to 119).

    #60167

    Hi Nicholas:

    The “BuyPrice” is also supposed to change after every pyramid trade: Buyprice2…Buyprice3… is this variable being ignored?

    BTW, thanks for your reply. Is there a way to make it execute each pyramid only once? (I tried “ONCE” in combination with IF but it doesn’t work)

    #60171

    Nicholas:

    Don’t worry, I solved it.

    Cheers.

    #60183

    No, the BuyPrice don’t change because you are constantly storing the same value on the same candle. You can use TRADEPRICE instead, which refer to the real open price of the last N order.

    #60531

    Nicholas:

    Don’t worry, I solved it.

    Cheers.

     

    Hi,

    how did you solve it?

     

Viewing 8 posts - 1 through 8 (of 8 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login