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 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.
Thanks
Antony
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.
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:
The Atr function:
Thanks
Antony