1 small change in the code

 

guys i need some help kinda new to forex am playing around with a few strategies i have this MA EA that opens orders after MA cross and candle close but the problem it closes the order only on MA cross with out waiting for the candle to close need help changing that

i want the EA to close orders when MA cross and new candle opens

Files:
MA_Trades_EA.mq4  490 kb
 
scpmtf with out waiting for the candle to close need help changing that
  1. Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
              No free help (2017)

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2018)

    We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
              No free help (2017)

  2. You can't know when a candle closes. Only when a new tick arrives that starts a new bar is the old bar closed, and that tick could arrive almost at the end of a bar's duration.

    For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
              MT4: New candle - MQL4 programming forum #3 (2014)
              MT5: Accessing variables - MQL4 programming forum #3 (2022)

    I disagree with making a new bar function, because it can only be called once per tick (second call returns false). A variable can be tested multiple times.
              Running EA once at the start of each bar - MQL4 programming forum (2011)

 
  • Usually people who cannot code do not receive free help on this forum, although it could happen if you are lucky. Be patient.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free).
  • Finally, you also have the option to hire a programmer in the Freelance section.
 

Please don't post randomly in any section. Your question is not related to the section you posted.

I have moved your topic to the correct section, namely MT4/mql4 section on the forum.

 
Fernando Carreiro #:

Please don't post randomly in any section. Your question is not related to the section you posted.

I have moved your topic to the correct section, namely MT4/mql4 section on the forum.

ok thx

Reason: