I have an EA that uses bands, and for what I believe to be better accuracy I am modifying the bands idicator so that I can be read by my EA, I have already done the Atr but as bands has two buffers to be looked at it has thrown me out a bit:
MovingBuffer[i]=iMA(NULL,0,BandsPeriod,BandsShift,MODE_SMA,PRICE_CLOSE,i);// already part of fileif(!GlobalVariableCheck(gvReqwest)){
int shift = GlobalVariableGet(gvReqwest);
GlobalVariableSet(gvName,UpperBuffer[shift]);
GlobalVariableSet(gvName,LowerBuffer[shift]);
}
Now I am trying to work out the EA side of things,a need to define the upper and moving buffer to be used in condition statements, this is what I have so far, is this right?:
double BB(string up_dn, int barback){int tf = 0;
string gvName = "BandsForAntony";
string gvSetting = "EaForBandsSetting";
string gvReqwest = "EaForBandsRqwest";
int theBandsPeriod;
if(Period() == PERIOD_M1)
theBandsPeriod = BandsPeriod2;
else
theBandsPeriod = BandsPeriod;
GlobalVariableSet(gvSetting,theBandsPeriod);
if(!GlobalVariableCheck(gvName)){
Comment("You forgot to to set indicator BANDS!");
//defualt to below if I forgot to add the idicator...double hi = iBands(Symbol(),Period(),theBandsPeriod,BandsDeviation,0,PRICE_CLOSE,MODE_UPPER,barback);
double lo = iBands(Symbol(),Period(),theBandsPeriod,BandsDeviation,0,PRICE_CLOSE,MODE_LOWER,barback);
double md = iMA (Symbol(),Period(),theBandsPeriod,0,0,PRICE_CLOSE,barback);
}
if(BandsSetArrow){
SetArrow(4,Teal,hi,"BB hi",Time[barback]);
SetArrow(4,Teal,md,"BB midle",Time[barback]);
SetArrow(4,Teal,lo,"BB lo",Time[barback]);
}
if(up_dn == "up"){
return(hi);
}
if(up_dn == "dn"){
return(lo);
}
return(md);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi
I have an EA that uses bands, and for what I believe to be better accuracy I am modifying the bands idicator so that I can be read by my EA, I have already done the Atr but as bands has two buffers to be looked at it has thrown me out a bit:
I have added this to indicator, near the top:
This before int start():
And of course this:
Now I am trying to work out the EA side of things,a need to define the upper and moving buffer to be used in condition statements, this is what I have so far, is this right?:
Thanks
Antony