fxDreema

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

    Trailing stop on last bar's close

    Questions & Answers
    2
    4
    1015
    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.
    • T
      teobusetti last edited by

      Hello everyone! 🙂

      I am trying to set a trailing stop loss based on the previous bar {Close Price + 2ATR} (for sell orders) and {Close Price - 2ATR} (for buy orders).
      I have tried to use loop blocks and the trailing stop block (blocks 41 to 44) but I cannot find a way to set the price "reference" as the previous candle close and to make this happen for every new bar created...does anyone know how to do this?

      https://fxdreema.com/shared/AkT0UWaM

      Thanks!!

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

        Try something like this: http://prntscr.com/c3gik7
        But about the ATR value, put it in a Variable. I named it like "ATRValue" only for the example.
        I also think that 2 Trailing Stop blocks must be used, because of the "+" and "-" used for buys and sells

        1 Reply Last reply Reply Quote 0
        • T
          teobusetti last edited by

          __Try something like this: http://prntscr.com/c3gik7
          But about the ATR value, put it in a Variable. I named it like "ATRValue" only for the example.
          I also think that 2 Trailing Stop blocks must be used, because of the "+" and "-" used for buys and sells[/quote:199rh1k4]

          Thanks for the input! But I do not quite understand what you have done there...I cannot see anywhere a reference to the previous bar close price and I cannot understand why you take the ATRvalue+ATRvalue2 , I would like PreviousClose+ATR2 ....could you explain it please? 🙂

          I have tried to update it like this https://fxdreema.com/shared/5hV58uyNd but like this it does not work on MT4 - I have attached a screenshot with the errors...any idea why it cannot run?

          ......
          Screen Shot 2016-08-09 at 22.00.22.png

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

            The error means that SL is 0. SL is used for this particular MM and can't be 0, it must be something.

            I touched this project a little bit: https://fxdreema.com/shared/K3KusLlie
            So, you calculate all variables once per bar. But then you Buy/Sell at any time in the middle of the candle. The problem is that in the middle of the candle the price moves and eventually the calculated SL levels become wrong.

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

            Online Users

            D

            6
            Online

            146.7k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors