fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Sell orders being deleted

    Questions & Answers
    2
    3
    669
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jdwbryan last edited by

      I'm having trouble with a simple EA to trade Fractals. For some reason my sell pending orders keep getting deleted on the next bar after being created.

      This is the project: https://fxdreema.com/shared/Thgq5LPte

      What is supposed to happen:

      For Buys: If a Fractal Up (Candle ID 3) forms above the defined EMA, place a Buy pending order 1 pip above the fractal. If a new Fractal Up is formed prior the first being triggered, then the EA should delete previous Buy orders and place a new order at the new Fractal.

      For Sells: The reverse of Buy. If a Fractal Down (Candle ID 3) forms below the EMA, place a Sell pending order 1 pip below the fractal. Again if a new Fractal Down forms prior to the previous order being triggered, it should cancel the previous pending Sell orders and place a new order at the new fractal.

      What is actually happening:

      Buy orders seem to be working exactly as intended, but for some reason the Sell orders are not. The EA is placing sell orders the way it should, but then for some reason the orders are being deleted on the next candle (unless the order gets triggered immediately). It is probably some silly simple thing, but I can't figure out for the life of me why this is happening. I tried changing Candle ID on the fractals and the EMA (I know I have a different ID on the EMA, but setting it the same as the Fractal seemed to make matters even worse), and even tried starting over from scratch in case I had messed something up, but still the same thing. Any help would be greatly appreciated.

      1 Reply Last reply Reply Quote 0
      • fxDreema
        fxDreema last edited by

        The problem here is that if Fractal Down is not present, it's value is 0. As you can imagine, 0 is always lower than any Moving Average value.

        "Condition" block will not pass if one of it's operands equals to EMPTY_VALUE (the biggest integer value), which is the value that custom indicators use to tell the EA that their buffer is not present. So, "Condition" block will not pass if indicator is used in it and the buffer that is selected for it is "invisible". But this is not the case with Fractals, it uses the value of 0 instead of EMPTY_VALUE and "Condition" just uses this value as any other normal value that is not EMPTY_VALUE.

        I will not make the "Condition" block to not pass when one of it's values is 0, because there are indicators where this value is very normal, and also negative values are normal.

        So, what you can do is to check if the indicator value is positive above block 4 🙂

        1 Reply Last reply Reply Quote 0
        • J
          jdwbryan last edited by

          I knew I was missing something silly! Thank you!

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          Online Users

          S
          K
          M
          R
          D
          S
          B
          D

          16
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors