Is it possible to cross time frames in practical EA development? For example, I want to go long when both 1 hour and 4 hours are long, or short when both 5 minutes and 1 hour are short.
Can the code be put into practice? There will be no problem with the program logic during backtesting
- EA coding problem
- Help with Simple Code Programed Into An EA??
- Trading Time problems in EA
-
enum TimeFrames { TF_M5 = 5, TF_H1 = 60, TF_H4 = 240 }; // Check if the given time frame is bullish bool isBullish(const int timeframe) { double ma = iMA(NULL, timeframe, 50, 0, MODE_SMA, PRICE_CLOSE, 0);
Why did you post your MT4 answer in the MT5 General section question?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017) - Don't hard code constants. Use the provided symbols. PERIOD_H1 is not 60 in MT5.
enum TimeFrames { TF_M5 = PERIOD_M5, TF_H1 = PERIOD_H1, TF_H4 = PERIOD_H4 };
- Nardus Van Staden #: start() function is the entry point of the EA,
You should stop using the old event handlers (init, start, deinit) and IndicatorCounted() and start using new event handlers (OnInit, OnTick/OnCalculate, OnDeinit).
Event Handling Functions - MQL4 Reference
How to do your lookbacks correctly - MQL4 programming forum #9-14 & #19 (2016)

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register