fxDreema

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

    Trailing Stop Is.... Multiple Levels (minor glitch report)

    Questions & Answers
    2
    8
    1312
    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.
    • G
      greatscott last edited by

      This is exactly the feature I'm looking for! And it looks functional, except:

      1. It doesn't seem to take the spread into consideration. For example, if the first stoploss move triggers at +10 pips of profit and there's a 2-pip spread, the EA actually moves the stop loss when the trade is +8 pips in profit. I confirmed this on a couple different pairs and multiple trades.

      2. Is there any way to use variables for the levels so they can be adjusted in the inputs?

      Even if it can't be done from within fxdreema, if someone knows the syntax for using a variable name inside a string I can do it manually in the MQL file:

      static string tStopMultiple = "5/1, 10/6, 15/11";
      

      https://fxdreema.com/shared/dFz2GhxGc

      I'm really liking fxdreema; I think I'll build my next full EA project with this tool. 🙂

      -Scott

      Edit: Just confirmed it happens on both buy and sell orders.
      Edit2: DANGIT I just realized there's a separate forum for bug reports. Sorry.

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

        I often say that "For each Trade" is needed, but in this case it's not needed. Blue blocks have their loop inside, they have their "For each Trade" inside.

        About the spread issue, try to change this "Reference price" option. I'm not 100% sure right now that this will take effect with the Multiple Levels option, but I blieve it will, it should.

        Well, you can see that there is 1 field to put multiple values. This value is string value. The string is parsed in the MQL4 code every time the block runs. So yes, changes are possible. But the way to do that is not very straight forward. Now, whatever you write there, it is part of the string. Write the name of some Variable, and it will NOT see the Variable, it will only see it's name. So, a little hack is needed.

        If you have this instead:

        ""+"5/1, 10/6, 15/11"+""
        

        ... now you have direct MQL4 control. And you can do something like this:

        ""+"5/1, "+MyVariable+"/6, 15/11"+""
        

        ... but again, this is not something that I would recommend to do. It just happen to work, but It's ugly. And yes, there is double "" in the beginning and the end. I will not explain why, it just works that way. With single " you will see errors.

        The other way is of course to build the string outside the block, to put it in some Variable and then to use this variable for Multiple Levels.

        1 Reply Last reply Reply Quote 0
        • G
          greatscott last edited by

          Thank you very much!

          I almost had that MQL syntax correct, I was missing the + symbols. 🙂

          I'll give all this another try when the market opens.

          -Scott

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

            Yes, you need to know a little bit of MQL4 here. By adding those ""+ and +"", you have MQL4 code inside. In fact, for all numeric values, their input fields already contain MQL4 code. But this is a string, and you know - strings are different from numeric values with their " ". But in fxDreema those " " are automatically added later and because of that you need to do this trick.

            1 Reply Last reply Reply Quote 0
            • G
              greatscott last edited by

              I was able to confirm via backtesting that both your suggestions worked perfectly!

              1. Switching the "Reference Price" to Bid for Buy fixed the spread not being taken into account.

              2. Your MQL syntax was perfect.

              static string tStopMultiple = ""+First_Trail_Start+"/"+First_Trail_Stop+", "+Second_Trail_Start+"/"+Second_Trail_Stop+", "+Third_Trail_Start+"/"+Third_Trail_Stop+", "+Fourth_Trail_Start+"/"+Fourth_Trail_Stop+", "+Fifth_Trail_Start+"/"+Fifth_Trail_Stop+", "+Sixth_Trail_Start+"/"+Sixth_Trail_Stop+", "+Seventh_Trail_Start+"/"+Seventh_Trail_Stop+"";
              

              Last question, I promise. 🙂 In both the "If Trade" and "Trailing Stop" blocks, if I set Market Mode to "any market", the EA will manage all of the trades on the account, not just the symbol that I attached it to. Right? 😮 😎

              https://fxdreema.com/shared/Nvh2k11Jd

              -Scott

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

                Yes and no. The market name is only one of the parameters, there is also Gropu (which is related to the magic number). You will be able to work with trades from another markets, but only if they are made with the same Group number

                1 Reply Last reply Reply Quote 0
                • G
                  greatscott last edited by

                  I've owned the "EA Wizard" software (for building EAs) for a few years but I can tell you that in just a few days I can see fxdreema is significantly more powerful.

                  1. It can manage manual trades (EA Wizard requires a magicnumber to manage a trade)

                  2. It can manage all pairs on an account, not just the pair that the EA is attached to

                  3. I was able to set up a trailing stop trade management EA with just one rule (block) instead of creating 14 separate rules (7 levels of buys and 7 levels of sells).

                  EXTREMELY impressed. Great job!

                  -Scott

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

                    1. and 2) I think that dealing with magic numbers and symbol names is not so complicated. They are only values after all

                    2. Yes, the trailing stop block is like a whole EA. But still, sometimes you need to 2 separate, but almost the same groups of blocks - for the Buy part and for the Sell part. I will eventually find a way to do this with only 1 group of blocks.

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

                    Online Users

                    R
                    M
                    U
                    C
                    V
                    N
                    P

                    14
                    Online

                    146.8k
                    Users

                    22.4k
                    Topics

                    122.6k
                    Posts

                    Powered by NodeBB Forums | Contributors