fxDreema

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

    A simple EA question

    Questions & Answers
    4
    14
    2972
    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.
    • L
      leochangchen last edited by

      Hello everyone on fxdreema,

      https://fxdreema.com/shared/LboEbHIod

      I have done before 2 custom indicators (wrote directly on MT4)
      but never had experience with EA,
      today I just want to write a simple EA : when the last candle close price is higher/lower then a price I set (input),
      then open a trade Buy/Sell with lot input (can be without S/L or T/P)

      I have tested with this EA of shared link, but it did not opened any trade,
      for example I tested EURUSD M1, input condition price = 1.3337
      when last candle close at 1.3338, it did not open the trade,

      any suggestion if I did wrong ?
      any help will be greatfull, thank you~

      PS: btw, I got an error when I check the checkbox of input of "CurrentTimeFrame", if I uncheck it, it compiled successfully

      1 Reply Last reply Reply Quote 0
      • J
        josecortesllobat last edited by

        Do try this out

        0_1549725011706_ce467b17-929d-470c-9cbf-278e42526589-image.png

        1 Reply Last reply Reply Quote 0
        • L
          leochangchen last edited by

          Gracias Jose,

          I will try your form soon,
          so the condition block I'm doing well ?
          setted Close candle > numeric Value,

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

            It looks that it should work, but it really depends on the values you provide. Look at the logs to see if there are any errors.

            L 1 Reply Last reply Reply Quote 0
            • L
              leochangchen @fxDreema last edited by

              @fxdreema wow~ thanks for reply Admin,
              btw,
              I got it work when I changed to MT4,
              but with same logic I can't let it work in MT5,
              it will work on MT5 when I disconnect the one of the two condition to "Non position",
              I mean, if I disconnect second condition, the first condition will buy,
              if I disconnect first condition, the second condition will sell,
              but connected both condition, no one is working,

              In MT4, both condition connected to "No Trade" will work both,

              btw, May I ask how to get value of indicator ATR to declare a variable for TP/SL?
              I wish to put for example,
              current ATR value (when open trade) * ATR_Multiplier (constant input or can be putted by user) = SL/TP

              Thanks in advance,
              also thanks again for your reply @josecortesllobat

              1 Reply Last reply Reply Quote 0
              • L
                leochangchen last edited by

                0_1550025781931_14b565d1-cde2-4ac0-871a-900d0e20f5e5-image.png
                can be this working?
                if yes, I know I can change the number "2" to a constant,
                but can I write to " * constant name"?

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

                  ART gives us values like 0.0010. I call them "price fraction", because this is like a small difference between two prices, like a small fraction of the whole vertical axis of the price. And to use that as a SL value, instead of "Custom (price level)" select "Custom (price fraction)". Price level - this is the value as it is.

                  About MT5... in which mode do you have it, because the profile can be in "netting" or "hedging" mode, and things are different.

                  1 Reply Last reply Reply Quote 0
                  • L
                    leochangchen last edited by

                    Thanks again for reply dear Admin,

                    I will write and test both "Custom (Price Level)" and "Custom (Price Fraction)" in a demo to see the difference,

                    and about the mode netting or hedging, where I can check this?
                    btw, I let them default while creating my MT4 and MT5 project

                    1 Reply Last reply Reply Quote 0
                    • L
                      leochangchen last edited by

                      btw, I wish to add "Once per day" filter,
                      "Once per day" mean it will check the condition I putted and open a trade only once per single day right?
                      and how can I write if I wish to close all opened trade on the finish of each day?
                      will be two block of "Once per day" Time filter?

                      0_1550652428055_0827af5b-ff75-4f0e-b7ec-7e1e5d61e60b-image.png

                      is this logic correct? (forget about the blocks number because I created them in random just to take a screenshot :P)

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

                        Hedging or netting - this is one small check when you make a new account in MT5.

                        "Once a day" means that the block can pass max 1 times in a day. You see that it has some settings inside to choose the hour - it's more like a period of 1 particular minute in which the block is allowed to pass once. With default settings if you have this block on the top (and under the "on Tick" event of course) it will pass once in 00:00 every day. Well, on the first tick of the day, which is normally at 00:00.

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

                          I have noticed most brokers nowadays offer only hedging mode on new accounts, I've usually had to ask their support to change my account to netting mode.

                          Need small help? Tag me in your post
                          Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                          1 Reply Last reply Reply Quote 0
                          • L
                            leochangchen last edited by

                            @fxDreema thanks again Admin, I will google about hedging and netting or ask my broker,

                            regards the "Once per day", if I choice "Hours Period",
                            let's say Start hour from (00:00) End hour to (12:00)
                            the condition I put under the block "Once per day" will be checked repeatedly during 00:00~12:00?
                            or will only check max 1 time during these hours,
                            here's where I'm a bit confused

                            @roar Thanks also for your reply, I will check this with the broker

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

                              Every "Once per..." block is checked on every tick if you place it on top level under "on Tick". In other words, such block will check if it is allowed to pass or not every time it runs. And it will pass 1 time in its period. "Once per bar" for example, when it runs, it can recognize if the current candle is new for it and will pass is this is true, then until the candle is the same it will not pass again.

                              1 Reply Last reply Reply Quote 0
                              • L
                                leochangchen last edited by

                                @fxDreema Thanks again Admin for the detailed explanation
                                I will continue learn and do more to build mi EA
                                really appreciate your fxdreema project and the website

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

                                Online Users

                                C
                                N
                                D
                                P
                                K
                                K
                                W
                                A
                                A
                                E

                                22
                                Online

                                146.8k
                                Users

                                22.4k
                                Topics

                                122.6k
                                Posts

                                Powered by NodeBB Forums | Contributors