Can anyone please explain what is wrong here? - page 2

 
Greetings :)
Try to type in google Anna Monti or forex freebot. I think it'll be interesting for you :)
 

Thanks for the links.

I understand that I could use the iCustom function instead of global variables, I have attached the Atr indicator, could anyone show me how to use iCustom? as I am a little confused with this.

double Atr(int shift){
   string gvName    = "AtrForAntony";
   string gvSetting = "EaForAtrSetting";
   string gvReqwest = "EaForAtrRqwest";
   double res;

   int theAtrPeriod;
   if(Period() == PERIOD_M1)
      theAtrPeriod = AtrPeriod2;
   else
      theAtrPeriod = AtrPeriod;
      
   GlobalVariableSet(gvSetting,AtrPeriod);
   if(!GlobalVariableCheck(gvName)){
      Comment("You forgot to to set indicator ATR");
      res = iATR(Symbol(),Period(),theAtrPeriod,shift);

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

Thanks

Antony

Files:
atr.mq4  3 kb
 
tonyjms2005:


Will I have to use iCustom to call the metaquotes atr indicator that will be attached to the same chart?

Thanks

Antony

Depends on which Metaquotes indicator you have in mind. With a fresh terminal install, you'd normally get two of them:

* 'Average True Range' under 'Indicators'; this is the one called with iATR() and one you cannot modify;

* 'ATR' under 'Custom Indicators'; this is the one you can edit but which has to be called with iCustom().

As per your first post, it seems you've modified the latter but were using the former.

 
Drave:

Depends on which Metaquotes indicator you have in mind. With a fresh terminal install, you'd normally get two of them:

* 'Average True Range' under 'Indicators'; this is the one called with iATR() and one you cannot modify;

* 'ATR' under 'Custom Indicators'; this is the one you can edit but which has to be called with iCustom().

As per your first post, it seems you've modified the latter but were using the former.


Hi

Thanks for the reply, I am using the custom indicator. Would this be correct:

add this to the top of the EA file:

extern string IndicatorName = "ATR";

The Atr function:

double Atr(int shift){
     double res;
      
       res = iCustom(NULL, 0, IndicatorName,0,shift); 

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

Thanks

Antony