Plz help

 

I am taking ATR values ​​from TF D1 and using them for SL-TP data but when running it again I get error quote!!!!

 // ATR
double ATR()
  {
   double ATR_min = 0.1;
   double ATR_maxx = 4.1;
   double HeSo_ATR = 100000;
   ATR14 = NormalizeDouble(iATR(Symbol(),PERIOD_D1,ATR14_Period,1),4);
//
   if(ATR14 >= ATR_min)
     {
      HeSo_ATR = 1000;
     }
   if(ATR14 >= ATR_maxx)
     {
      HeSo_ATR = 100;
     }
//
   ATR15 = ATR14 * HeSo_ATR;
     {
      ATR16 = ATR15/2;
     }
   return(HeSo_ATR);
  }
 
Nguyen Thanh Ha:

I am taking ATR values ​​from TF D1 and using them for SL-TP data but when running it again I get error quote!!!!

would of course be useful if you said what error you get!

assuming this is MT5, then you need to read the manual because iATR returns a handle for use with copybuffer where you get the actual values.


https://www.mql5.com/en/docs/indicators/iatr

Documentation on MQL5: Technical Indicators / iATR
Documentation on MQL5: Technical Indicators / iATR
  • www.mql5.com
The function returns the handle of the Average True Range indicator. It has only one buffer. Parameters symbol [in] The symbol name of the security...
 
like Paul said, iATR doesn't return any ATR value, it returns a handle code. 
Think twice about using AI instead of the documentation lol
 
   ATR14 = NormalizeDouble(iATR(Symbol(),PERIOD_D1,ATR14_Period,1),4);

That is a MT4 call. Which language are you using?

Why did you post your code question in the MT5 General section instead of the MQL4 section, (bottom of the Root page) or in the MT5 EA section?
          General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)