iATR on price open...

 

Hi

I have an EA that uses ATR:

res = iATR(Symbol(),Period(),theAtrPeriod,shift);
   
   return(NormalizeDouble(res,Digits));
   return(res);

I have comments on the chart showing what the EA is seeing, I have found that sometimes the EA misses a trade because it was showing a very slightly different atr value but just enough to cause a missed tried, could anyone help explain why this maybe? Please note I am not an experienced coder but I like to have a go.

Thanks

Antony

 

I did try this but it returns a constant zero figure:

res = iCustom(Symbol(),Period(),theAtrPeriod,PRICE_OPEN,shift);
Antony
 

Does this indicator operate on price_close? if so can it be made to work on price_open?

double Atr(int shift){

   double res;

   int theAtrPeriod;
   if(Period() >= PERIOD_M5 && Period() <= PERIOD_M30)
      theAtrPeriod = AtrPeriod2;
   if(Period() >= PERIOD_H1)
      theAtrPeriod = AtrPeriod3;
   if(Period() >= PERIOD_M1 && Period() < PERIOD_M5)
      theAtrPeriod = AtrPeriod;

    res = iATR(Symbol(),Period(),AtrPeriod,shift);

   return(NormalizeDouble(res,Digits));
   return(res);
  }

Thanks

Antony

Reason: