coding problem for EA

 
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
 
  1. 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)

  2. 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
    };

  3. 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)