fxDreema

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

    Trailing stops EA

    Questions & Answers
    2
    10
    1522
    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.
    • P
      ptejerina last edited by

      Hi,

      I'm using fxdreema for the first time and this is my first project: https://fxdreema.com/shared/tpp5KmfRc

      However, it doesn't work! What I want to do is an EA that automatically sets a stoploss in the low of the previous bar in a buy order or in the high of the previous bar if in a sell order. This must be done only if the previous bar closed in the same direction of the order, that is only move the stoploss if previous bar was bullish for buys o bearish for sells.

      Can someone please help me understand why my EA does nothing? 😕

      Thank you.

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

        If you have no action from this EA, then I think you want to modify manually opened trades. Each EA is set by default to NOT work with manually opened trades, or trades made by other EA. There are 2 ways to deal with this: http://prntscr.com/bmqvx6
        http://image.prntscr.com/image/1c9c270f57244fa98668f69a3730cf2b.png

        1 Reply Last reply Reply Quote 0
        • P
          ptejerina last edited by

          Yes! Thank you, that was it. I made my first EA 🙂

          What an excellent tool is fxdreema, congratulations.

          1 Reply Last reply Reply Quote 0
          • P
            ptejerina last edited by

            Hi fxdreema,

            In the picture you can see how I'm setting my stoploss for short trades. What I want to accomplish is to set the stoploss on the high of the previous candle + 1 pip + spread. I'm getting the (high of candle + 1pip) part ok, but I haven't been able to add the spread automatically. How can I get it done? Thanks.

            http://content.screencast.com/users/ptejerina/folders/Jing/media/c77d56eb-8342-445a-837f-f15627bd0634/2016-07-01_0617.png

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

              Try to change this option "Price relative to"

              1 Reply Last reply Reply Quote 0
              • P
                ptejerina last edited by

                I tried every option in "Price relative to" and the result was always the same with all of them: the stoploss of sell orders was set to 1 pip distance but without adding the spread.

                In the 6th block "modify stops of sell", of the copy I'm sharing below, I have "Price relative to" set to "bid for buy, ask for sell" but, as I explained before, it only adds 1 pip but not the spread. What else can I try?

                https://fxdreema.com/shared/Fez6XP8J

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

                  As MQL4 code this is the spread of the current symbol: ```
                  MarketInfo(Symbol(), MODE_ASK) - MarketInfo(Symbol(), MODE_BID)

                  
                  Otherwise you can get it's value and put it into a Variable with "Modify Variables" block.
                  1 Reply Last reply Reply Quote 0
                  • P
                    ptejerina last edited by

                    In the code, how would I find what is shown in the block to add what you suggest? If you could please tell me a part of what the code would say, I would be able to find it and modify the formula. Thank you.

                    http://content.screencast.com/users/ptejerina/folders/Jing/media/c77d56eb-8342-445a-837f-f15627bd0634/2016-07-01_0617.png[/quote]

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

                      The contents of the Adjust field where you now have "+1pips" goes to the output MQL4 code almost directly. This is also true for all input fields. You can write MQL4 functions everywhere, not only numbers

                      1 Reply Last reply Reply Quote 0
                      • P
                        ptejerina last edited by

                        It worked. Thanks.

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

                        Online Users

                        J
                        A
                        Z
                        T

                        13
                        Online

                        146.7k
                        Users

                        22.4k
                        Topics

                        122.6k
                        Posts

                        Powered by NodeBB Forums | Contributors