fxDreema

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

    Trailing pending orders not working

    Questions & Answers
    2
    4
    1141
    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.
    • B
      brightlaw last edited by

      Hi, the motive of this ea is to capture rapid market movements during major news events, (e.g. Non-farm payroll).

      I will be manually placing the pending orders (buy stops and sell stops).

      1. Once I've placed my pending orders, the ea should immediately detect and automatically place a stop-loss for the pending orders.

      2. For every minute, (each time a new 1 minute candlestick opens), the ea should adjust the pending orders (buy stop and sell stop) to be 20 pips away from the current market price.

      3. Once pending orders are triggered and the trade is 20 pips in profit, stop loss will be moved to break even.

      Below is the link to the ea I've made but doesn't seem to work. Would you kindly identify the problem? Thank you.

      https://fxdreema.com/shared/gx16pbJK

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

        There is something called "Magic Number". Expert advisors should work only with trades and orders created by them, this is the idea. Magic Number for manually created trades and orders is 0. Your EA is set up to work with number 1879, which is automatically generated random number. You can edit this number in the project settings (the bench icon on the lower right corner in fxDreema). It appears as "Magic Start" there. Then, in the EA this is input parameters called "MagicStart".

        2 options:

        • If you only want to work with manually created trades and orders, set MagicStart to 0 and everything should be fine
        • Each trading block can be set to work with manually created trades/orders. Look at this parameter more closely: http://prntscr.com/6ooi3b
        1 Reply Last reply Reply Quote 0
        • B
          brightlaw last edited by

          Hi, I changed it and it's working now. It's not working the way I wanted it to be tho. If the pending orders (stops and limits) are above the current market price, it only trails downwards as the market goes down. When the market goes up, the pending orders will get hit.

          How do I set it so that the pending orders trail in both ways? Which means that the pending orders will always maintain a distance from the current market and will never get hit.

          I will include a filter (Once every bar/minute) so during market spike when news are released, the pending orders will get hit. But right now I need the pending orders to trail in both direction.

          https://fxdreema.com/shared/5qkEYvt6e

          Thank you.

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

            Here is how to keep all orders at 20 pips away from the current price, but note that this is too aggressive, orders are modified on every tick and if you don't use some time filter the broker will hate you: https://fxdreema.com/shared/2R7PZiMed

            I realized that I can't found make the opposite of "pips away from open price". I wanted to detect when the distance is lower than 19 pips, so I tried with negative values in "pips away from open-price", but nothing worked. As I created this block long time ago, I don't even remember how it should handle this 🙂

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

            Online Users

            C

            21
            Online

            146.8k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors