fxDreema

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

    Trying to set buy/sell at candle close not working right

    Questions & Answers
    4
    9
    2713
    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.
    • M
      makamilman last edited by

      I set the condition for candle close to buy sell above/below 30sma at close of candle. There is another oscillator I'm using with it but is working fine with this. The EA is buying/selling when price/wick of candle crosses 30sma, not at the closing of the candle. I have it set at candle close and the MA as price close. How do I prevent this and get it to buy/sell at the close of candle only? Thanks.

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

        If you attach a link to your project someone may have a look at it for you. Hard to help without seeing the blocks.

        1 Reply Last reply Reply Quote 0
        • M
          makamilman last edited by

          I would be grateful if someone could look at the blocks and determine the issue.

          Not sure how to attach my blocks I created. I've uploaded the EA here. If I need to do something else, please advise.

          I also only want this to trade one time on a cross. It appears that when the trade hits TP or SL, it will open another trade before crossing the MA again.

          0_1550073588939_SimpleMA_AO_CrossEA.ex4

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

            In your fxdreema builder go "project" -> "create shared copy".

            Solution: use the block "once per bar" at the top of your logic tree

            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

            M 1 Reply Last reply Reply Quote 0
            • M
              makamilman @roar last edited by

              @roar Thanks for the reply. I'm not sure if using a "once per bar" order would work for what I was looking for. I only want to create a trade once per crossing. Right now it will close a trade with TP or SL hit and then open another trade if conditions are still there. But I don't want it to trade again until opposite crossing occurs. This could be one or many bars after initial trade. I will attach the link. I appreciate any input. (https://fxdreema.com/shared/t15Hptq8c)

              roar 1 Reply Last reply Reply Quote 1
              • roar
                roar @makamilman last edited by

                @makamilman
                Try this version, I think it is closer to what you want:
                https://fxdreema.com/shared/5EHm72tLd
                What I changed:

                • condition blocks use candle ID 1, that is the latest completed cande, not the updating one.
                • because we check the history candle, we can do it only "once per bar" because the situation won't change anyway until a new bar appears
                • trailing stop and breakeven don't need separation to buy/sell.
                • "trailing start is 100% of trailing stop" = trailing stop starts at the open price

                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

                M 1 Reply Last reply Reply Quote 0
                • M
                  makamilman @roar last edited by

                  @roar Thank you, I will give this a try and see how it performs. I appreciate your help.

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    makamilman @makamilman last edited by

                    @roar

                    Doesn't appear to have worked. I've attached an image of a EURUSD chart I was testing.As you can see, it traded twice so far without waiting to cross again. This is what I'm trying to avoid. I only want one trade per crossing. Otherwise the trend stops or turns but another trade is activated.
                    Any other thought on this would be appreciated. 0_1550157948277_EURUSDEA.png

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

                      I can see your project and I see that you have 2 Condition block in a row, both of which have x> inside. The problem is that x> detects a crossover that happens on the given candle, but before of after that candle you cannot find the same crossover. With your conditions you are saying that you want 2 separate crossovers (one with MA, one with Awesome Oscillator) to be true at the same candle. This could happen sometimes I guess, but I think that you don't want that.

                      So, try with one crossover. Change the other with > or >=. The thing is that if now line A is > than line B, then for sure line A crossed line B somewhere in the past.

                      Also I don't like where you placed the blue blocks - break even and trailing stop. Take a look at this example: https://fxdreema.com/demo/mt4-wrong-closing-rule
                      Also, only one of these blocks can work for both, buys and sells. So in short, disconnect block 6 from block 3 and remove blocks 8 and 9

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

                      Online Users

                      M
                      O
                      H
                      F
                      H
                      M
                      H

                      13
                      Online

                      146.7k
                      Users

                      22.4k
                      Topics

                      122.6k
                      Posts

                      Powered by NodeBB Forums | Contributors