fxDreema

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

    Cant get modify stops block to work

    Questions & Answers
    2
    3
    920
    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.
    • X
      Xander last edited by

      Hi all. Please help. My EA is programmed to open two trades. When certain conditions are met it needs to close the most profitable one (this is working), send a notification (also working) and modify the stop of the remainder based on the result of the below (not working). Not sure why the stop is not being modified?0_1537793548972_d959e143-5c34-4340-b8d1-541980b98bb7-image.png

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

        You are using those (on trade) options, but they are only do be used under the "on Trade" event. Are those blocks under "on Trade"?

        I think you have this calculation:

        OpenPrice - (ClosePrice - OpenPrice)

        To which trade that ClosePrice belongs to? While the trade is running, this is the current price and only after it closes it is the real price where it closed. Do you mean the current price of the current trade and do you want to do this for each trade?

        I'm not sure, but maybe you want to do something like this:
        0_1538132072105_5d7198bc-1ab8-453d-8798-286cfdfff80f-image.png

        The formula I wrote here is:

        MathAbs(OrderClosePrice() - OrderOpenPrice())
        

        ...where MathAbs(), OrderOpenPrice() and OrderClosePrice() are native functions in MQL4. Note that I selected Custom (price fraction)

        1 Reply Last reply Reply Quote 0
        • X
          Xander last edited by

          @fxdreema said in Cant get modify stops block to work:

          MathAbs(OrderClosePrice() - OrderOpenPrice())

          Works perfect thank you

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

          Online Users

          H
          R
          A
          E

          11
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors