Bollinger Bands Set Indicator For MT5
Table Of Contents:
- Bollinger Bands Set Indicator For MT5
- Installing the Bollinger Bands Set Indicator For MT5
- Parameters of the Bollinger Bands Set Indicator For MT5
- Buffers of the Bollinger Bands Set Indicator For MT5
- Main Parts Of The Code
The Bollinger Bands Set Indicator For MT5 automatically draws sets of Bollinger bands based on the historical price movement of the currency pairs. The upper 4 bands act as the critical resistance level and the lower 4 band acts as the critical support level. The higher the band is the higher the chance of making a profit. And look for the price action confirmation signals. Since you will be trading the dynamic bands make sure you are not taking too much risk in any trade since it can ruin your career. Stick to the conservative method so that you don’t have to lose a big portion of your investment by trying to execute the trade.
Installing the Bollinger Bands Set Indicator For MT5
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file x2ma_bbx9.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.
Parameters of the Bollinger Bands Set Indicator For MT5
The Bollinger Bands Set Indicator For MT5 has 14 parameters to configure.
input Smooth_Method MA_Method1=MODE_SMA; // First smoothing method input int Length1=100; // First smoothing depth input int Phase1=15; // First smoothing parameter input Smooth_Method MA_Method2=MODE_JJMA; // Second smoothing method input int Length2=20; // Second smoothing depth input int Phase2=100; // Second smoothing parameter, input int BandsPeriod=100; // BB smoothing period input double BandsDeviation1 = 1.0; // First level deviation input double BandsDeviation2 = 2.0; // Second level deviation input double BandsDeviation3 = 3.0; // Third level deviation input double BandsDeviation4 = 4.0; // Fourth level deviation input Applied_price_ IPC=PRICE_CLOSE; // Price constant input int Shift=0; // Horizontal shift of the indicator in bars input int PriceShift=0; // Vertical shift of the indicator in points
Buffers of the Bollinger Bands Set Indicator For MT5
The Bollinger Bands Set Indicator For MT5 provides 9 buffers.
SetIndexBuffer(0,X2MA,INDICATOR_DATA); SetIndexBuffer(1,ExtLineBuffer1,INDICATOR_DATA); SetIndexBuffer(2,ExtLineBuffer2,INDICATOR_DATA); SetIndexBuffer(3,ExtLineBuffer3,INDICATOR_DATA); SetIndexBuffer(4,ExtLineBuffer4,INDICATOR_DATA); SetIndexBuffer(5,ExtLineBuffer5,INDICATOR_DATA); SetIndexBuffer(6,ExtLineBuffer6,INDICATOR_DATA); SetIndexBuffer(7,ExtLineBuffer7,INDICATOR_DATA); SetIndexBuffer(8,ExtLineBuffer8,INDICATOR_DATA);
Main Parts Of The Code
int OnCalculate(const int rates_total, // number of bars in history at the current tick const int prev_calculated,// number of bars calculated at previous call const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //---- checking the number of bars to be enough for the calculation if(rates_total lt StartBars) return(0); //---- declaration of variables with a floating point double price_,x1xma,x2xma,stdev1,stdev2,stdev3,stdev4; //---- declaration of integer variables and getting already calculated bars int first,bar; //---- calculation of the first starting index for the bars recalculation loop if(prev_calculated gt rates_total || prev_calculated lt =0) // checking for the first start of the indicator calculation first=0; // starting index for calculation of all bars else first=prev_calculated-1; // starting index for calculation of new bars //---- main indicator calculation loop for(bar=first; bar lt rates_total && !IsStopped(); bar++) { //---- call of the PriceSeries function to get the input price price_ price_=PriceSeries(IPC,bar,open,low,high,close); //---- two calls of the XMASeries function. //---- The begin parameter is increased by StartBars1 in the second call, as it is another XMA smoothing x1xma = XMA1.XMASeries( 0, prev_calculated, rates_total, MA_Method1, Phase1, Length1, price_, bar, false); x2xma = XMA2.XMASeries(StartBars1, prev_calculated, rates_total, MA_Method2, Phase2, Length2, x1xma, bar, false); //---- X2MA[bar]=x2xma+dPriceShift; } //---- Bollinger Bands calculation main loop for(bar=first; bar lt rates_total && !IsStopped(); bar++) { //---- call of the PriceSeries function to get the input price price_ price_=PriceSeries(IPC,bar,open,low,high,close); stdev1=STD.StdDevSeries(StartBars2,prev_calculated,rates_total,BandsPeriod,BandsDeviation1,price_,X2MA[bar],bar,false); stdev2=stdev1*quotient2; stdev3=stdev1*quotient3; stdev4=stdev1*quotient4; ExtLineBuffer1[bar]=X2MA[bar]+stdev4+dPriceShift; ExtLineBuffer2[bar]=X2MA[bar]+stdev3+dPriceShift; ExtLineBuffer3[bar]=X2MA[bar]+stdev2+dPriceShift; ExtLineBuffer4[bar]=X2MA[bar]+stdev1+dPriceShift; ExtLineBuffer5[bar]=X2MA[bar]-stdev1+dPriceShift; ExtLineBuffer6[bar]=X2MA[bar]-stdev2+dPriceShift; ExtLineBuffer7[bar]=X2MA[bar]-stdev3+dPriceShift; ExtLineBuffer8[bar]=X2MA[bar]-stdev4+dPriceShift; } //---- return(rates_total); } //+------------------------------------------------------------------+