fxDreema

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

    Bug in TRAILING STOP in MQL5 Version

    Bug Reports
    3
    20
    6226
    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.
    • R
      re0306 last edited by

      .

      1 Reply Last reply Reply Quote 0
      • S
        shafqat last edited by

        due to trailing stop of fxdreema our mostly EA failed.long term strategies required default mt4 trailing stop. fxdreema please build a simple trailing stop like default mt4 trailing stop..your trailing is very complicated mostly member have problem with it.please check this link
        http://www.metatrader4.com/en/trading-p ... s/trailing

        1 Reply Last reply Reply Quote 0
        • S
          shafqat last edited by

          Trailing Stop

          Stop Loss is intended for reducing of losses where the symbol price moves in an unprofitable direction. If the position becomes profitable, Stop Loss can be manually shifted to a break-even level. To automate this process, Trailing Stop was created. This tool is especially useful when price changes strongly in the same direction or when it is impossible to watch the market continuously for some reason.
          trailing_stop_menu
          Trailing Stop is always attached to an open position and works in client terminal, not at the server like Stop Loss, for example. To set the trailing stop, one has to execute the open position context menu command of the same name in the "Terminal" window. Then one has to select the desirable value of distance between the Stop Loss level and the current price in the list opened. Only one trailing stop can be set for each open position.
          After the above actions have been performed, at incoming of new quotes, the terminal checks whether the open position is profitable. As soon as profit in points becomes equal to or higher than the specified level, command to place the Stop Loss order will be given automatically. The order level is set at the specified distance from the current price. Further, if price changes in the more profitable direction, trailing stop will make the Stop Loss level follow the price automatically, but if profitability of the position falls, the order will not be modified anymore. Thus, the profit of the trade position is fixed automatically. After each automatic Stop Loss order modification, a record will be made in the terminal journal.
          Trailing stop can be disabled by setting "None" in managing menu. And trailing stops of all open positions and pending orders will be disabled if the "Delete All" command of the same menu has been executed.
          โ€ขTrailing Stop works in the client terminal, not in the server (like Stop Loss or Take Profit). This is why it will not work, unlike the above orders, if the terminal is off. In this case, only the Stop Loss level will trigger that has been set by trailing stop.
          โ€ขTrailing Stop is processed once per tick. If multiple orders with Trailing Stop are open for one symbol, only the trailing stop of the latest open order is processed.

          1 Reply Last reply Reply Quote 0
          • R
            re0306 last edited by

            .

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

              This is what I tried:
              http://prntscr.com/bmqdi4
              And this is how it worked:
              http://prntscr.com/bmqdbh

              I got some modifications. I don't know what does not work. I need more information, what I am missing here?

              shafqat, I never tried the built-in trailing stop, but the block should work. There are so many settings, because people wanted them.

              1 Reply Last reply Reply Quote 0
              • R
                re0306 last edited by

                .

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

                  No, I did nothing. I also told you in the emails that it works for me. But MT5 is shit and I'm not surprised that something does not work for someone. But what... I can't easily tell if I don't see the problem. So I need more information, maybe some screenshots?

                  1 Reply Last reply Reply Quote 0
                  • R
                    re0306 last edited by

                    Wait a moment.
                    I try to make a video with settings and malfunction.

                    1 Reply Last reply Reply Quote 0
                    • R
                      re0306 last edited by

                      .

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

                        Haha, I just learned that there is Refresh button and I can reload the list of experts without restarting MetaTrader ๐Ÿ˜„
                        I was testing this for Buy, maybe the problem is in Sells, I will check this

                        1 Reply Last reply Reply Quote 0
                        • R
                          re0306 last edited by

                          ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜†
                          you never have to restart metatrader now on !!!

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

                            It works for me ๐Ÿ™‚ I don't see anything wrong in your video. Do you have error messages in the logs?

                            By the way, they lately allowed us to open multiple trades at the same time in MT5, just like MT4. If your account is like this, it will probably not work. These days I was trying to modify a position on such account,but there are problems and I still don't know how to fix them properly ๐Ÿ™‚

                            How do you make this video?

                            1 Reply Last reply Reply Quote 0
                            • R
                              re0306 last edited by

                              No error in the log.
                              It 'a demo account, but has nothing to do with the bug.

                              ......
                              Cattura.JPG

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

                                If this account was created with this option, I admit, it will not work:
                                http://prntscr.com/bmsfza
                                http://image.prntscr.com/image/66a9b493875e487daf5d3a9eb715612f.png

                                1 Reply Last reply Reply Quote 0
                                • R
                                  re0306 last edited by

                                  The video I recorded with "Camtasia Recorder".
                                  If you want I send two Torrent file to download Free application.

                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    re0306 last edited by

                                    So I have to open a new demo account without putting the check in "Use in hedge trading"? ๐Ÿ˜ฎ

                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      re0306 last edited by

                                      I tried to create a new demo account without a check "in use hedge trading"
                                      ย  and it works.
                                      ๐Ÿ˜ณ ๐Ÿ˜ณ ๐Ÿ˜ณ
                                      Still I do not understand what it's for this exception.
                                      Can you explain?
                                      ๐Ÿ˜ ๐Ÿ˜ ๐Ÿ˜

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

                                        I can explain.

                                        MT5 has two functions to make a position - OrderSend and OrderSendAsync. The first one, OrderSend is the one that is supposed to be synchronous. In other words, when this function is called in the code, the program will wait until there is response from the server and only then the program will continue to the next row in the code. While if you use OrderSendAsync, the program will not wait for the position to be created.

                                        I use OrderSend, but unfortunately this function is not 100% synchronous, it is semi-synchronous. Yes, the function will wait for responce from the server. But let's say that you modified SL of the position. If you try to load the position and read the new fresh SL, you will actually read the old SL. Only few moments later you will be able to read the new SL. I don't exactly know why it happens like this, I think that second responce must be received from the server. Let's say that this is the case, but that second response needs to be read from special event function - OnTradeTransaction(), which makes the code asyncronous.

                                        So how I deal with this situation - I have infinite loops immediately after OrderSend. Let's say that you modify SL. The first response from the server tells the EA that everything was fine and the SL was modified. But I need to wait until the data is updated locally. And I do exactly that - in an endless loop the EA is checking if SL is changed and when this is detected the EA exits the loop and continues to do it's other work.

                                        I must say that using infinite loops is something like a hack, it's never a good idea to use them like this, and this is not the right way to do things, but it works. And you know why I use them? Because there were problems when the EA is working on live. Everything works fine with or without these infinite loops in the Tester.

                                        But for some reasn if the account is made with the hedge option, nothing works the same way in the Tester. Maybe there is some bug, this is new option. I don't know, but my infinite loops just don't work in the Tester. If I remove them, then the problem will be that the data will not be updated immediately.
                                        Or, if I decide to use OnTradeTransaction() to catch the moment when the data is updated, this will make the way we connect blocks in fxDreema impossible. Because you want after some "modify" block to be able to read the modified data immediately.

                                        I don't know, I need some hack again. But at this time this "hedge" option is still new and I think that brokers still does not use it. Who knows whether they will... That's why I'm not in hurry to fix this problem ๐Ÿ™‚

                                        1 Reply Last reply Reply Quote 0
                                        • R
                                          re0306 last edited by

                                          Thank you for the explanation. Read these things in the morning makes me a headache! ๐Ÿ˜†

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

                                          Online Users

                                          E
                                          Y
                                          L
                                          F
                                          S
                                          F
                                          N
                                          S
                                          E
                                          H
                                          E

                                          21
                                          Online

                                          146.7k
                                          Users

                                          22.4k
                                          Topics

                                          122.6k
                                          Posts

                                          Powered by NodeBB Forums | Contributors