about the read differen period parameters problem

 
I read the indicator parameters of the 1-hour period on the 15 minute period,  I read the parameter was correct. However, when I run the EA open order, I found that the parameters of the indicators read were not accurate,Causing incorrect Openorder location
 
  1. Do you really expect an answer? There are no mind readers here and our crystal balls are cracked, so we can't see your machine.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

    We can't see your broken code.

    Always post all relevant code (using Code button) or attach the source file.


  2. On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
              Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)

 
William Roeder #:
  1. Do you really expect an answer? There are no mind readers here and our crystal balls are cracked, so we can't see your machine.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

    We can't see your broken code.

    Always post all relevant code (using Code button) or attach the source file.


  2. On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
              Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)

my code run yin 15 miu period

Files:
rsi.mq4  53 kb
 
  1. 47803124 #: my code run yin 15 miu period

    #1.2

  2. double close3=iClose(Symbol(),60,3);  
    double close4=iClose(Symbol(),60,4);  
    double close5=iClose(Symbol(),60,5); 
    double close6=iClose(Symbol(),60,6);     
    

    Don't hard code constants. Use the proper symbol (PERIOD_H1). Code breaks on MT5.

  3. Your code
        bool rsijinduo=false;
        bool rsijinkong=false;
        if((rsi1>rsi2)&&(rsi2<rsi3)) rsijinduo=true;
        if((rsi1<rsi2)&&(rsi2>rsi3)) rsijinkong=true;
    
    Simplified
        bool rsijinduo = rsi1>rsi2 && rsi2<rsi3;
        bool rsijinkong= rsi1<rsi2 && rsi2>rsi3;
    

  4.                if((OrderMagicNumber()==magicx)||(是否开有单))
    

    Code breaks if you forget to change the magic number when puting it on a different symbol.

    Magic number only allows an EA to identify its trades from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly and/or no Magic number/symbol filtering on your OrderSelect / Position select loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
              Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum (2013)
              PositionClose is not working - MQL5 programming forum (2020)
              MagicNumber: "Magic" Identifier of the Order - MQL4 Articles (2006)
              Orders, Positions and Deals in MetaTrader 5 - MQL5 Articles (2011)
              Limit one open buy/sell position at a time - General - MQL5 programming forum (2022)

    You need one Magic Number for each symbol/timeframe/strategy.
         Trade current timeframe, one strategy, and filter by symbol requires one MN.
         If trading multiple timeframes, and filter by symbol requires use a range of MN (base plus timeframe).
              Why are MT5 ENUM_TIMEFRAMES strange? - General - MQL5 programming forum - Page 2 #11 (2020)