hizicpainter:
Does anyone know of an indicator that will send an alert when a candle has posted above or below the upper or lower bollinger bands? I've seen a few that will alert when it crosses but I'm only interested in when a candle posts above or below the upper or lower bollinger bands.
"candle posts above or below"
What does that mean?
Keith Watford:
"candle posts above or below"
What does that mean?
Like this.
hizicpainter:
Like this.
You mean Closes above or below
I just modified a MQL4 indicator so it will be like your image above, and I post it here hoping someone will make it better and convert it into MQL5.
I often try to convert, but it is too difficult for me.
#property indicator_chart_window #property indicator_buffers 6 #property indicator_color1 Red //BB #property indicator_color2 Red //BB #property indicator_color3 Green //buy dot #property indicator_color4 Magenta //sell dot #property indicator_color5 Red #property indicator_color6 Blue #property indicator_width3 2 #property indicator_width4 2 extern int BobaPeriod = 21; extern int BobaDeviations = 1; extern bool Use_Sound=true; double BufferBand1[]; double BufferBand2[]; double BufferSell[]; double BufferBuy[]; double BufferSellEntry[]; double BufferBuyEntry[]; string UDBuy = ""; string UDSell = ""; int init() { //---- 2 additional buffers are used for counting. IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2); // two bollies SetIndexBuffer(0,BufferBand1); SetIndexStyle(0,DRAW_LINE); SetIndexDrawBegin(0,BobaPeriod); SetIndexBuffer(1,BufferBand2); SetIndexStyle(1,DRAW_LINE); SetIndexDrawBegin(1,BobaPeriod); // marks for gimmees SetIndexBuffer(2,BufferSell); //buy SetIndexStyle(2,DRAW_ARROW); SetIndexDrawBegin(2,BobaPeriod); SetIndexArrow(2, 167); SetIndexEmptyValue(2, 0); SetIndexBuffer(3,BufferBuy); //sell SetIndexStyle(3,DRAW_ARROW); SetIndexDrawBegin(3,BobaPeriod); SetIndexArrow(3, 167); SetIndexEmptyValue(3, 0); // marks for entries SetIndexBuffer(4,BufferSellEntry); //buyEntry SetIndexStyle(4,DRAW_ARROW); SetIndexDrawBegin(4,BobaPeriod); SetIndexArrow(4, 238); SetIndexEmptyValue(4, 0); SetIndexBuffer(5,BufferBuyEntry); //sellEntry SetIndexStyle(5,DRAW_ARROW); SetIndexDrawBegin(5,BobaPeriod); SetIndexArrow(5, 236); SetIndexEmptyValue(5, 0); // IndicatorShortName("GimmeBar "); return(0); } int start() { int counted_bars= IndicatorCounted(); int lastbar; if (counted_bars>0) counted_bars--; lastbar= Bars - counted_bars; GimmeeBar(0, lastbar, BufferSell, BufferBuy, BufferSellEntry, BufferBuyEntry, BufferBand1, BufferBand2, BobaPeriod, BobaDeviations); return (0); } double GimmeeBar(int offset, int lastbar, double &sellbuf[], double &buybuf[], double &sellbuf2[], double &buybuf2[], double &band1buf[], double&band2buf[], int period, int deviation) { double band1, band2; int markerdist= 25; // distance between bars and marker dots lastbar= MathMin(Bars-period, lastbar); for(int i= lastbar; i>=offset; i--) { sellbuf[i]= 0; buybuf[i]=0; sellbuf2[i]= 0; buybuf2[i]=0; band1= iBands(NULL,0, period, deviation, 0, PRICE_CLOSE, MODE_UPPER, i); band2= iBands(NULL,0, period, deviation, 0, PRICE_CLOSE, MODE_LOWER, i); band1buf[i]= band1; band2buf[i]= band2; // 1. Prices were rising. // 2. Prices touched the upper band. // 3. The price bar closed lower than it // opened when prices were previously rising. // or vice versa if ((Close[i+1] < band1) && (Close[i] >= band1)) { sellbuf[i]= Close[i] + markerdist*Point; if (i < 2 ) { UDBuy = "m Up"; DoAlertBuy(UDBuy); } } if ((Close[i+1] > band2) && (Close[i] <= band2)) { buybuf[i]= Close[i] - markerdist*Point; if (i < 2 ) { UDSell = "m Down."; DoAlertSell(UDSell); } } // Should such a price bar occur, a sell short order is to be executed // one tick below the low of the Gimmee bar. // if (sellbuf[i+1]!=0 && Low[i]<Low[i+1]-1*Point) { // sellbuf2[i]= Low[i+1]-1*Point; // } // if (buybuf[i+1]!=0 && High[i]>High[i+1]+1*Point) { // buybuf2[i]= High[i+1]+1*Point; // } } /* if (DebugLogger) Print(TimeOffset(offset), "BG-GimmeBar ", ""); */ return (0); } void DoAlertBuy(string UDBuy) { if (!NewBar() || !Use_Sound) return; Alert(Symbol(), " ", Period(), " ", "Buy"); //PlaySound ("Alert2"); } void DoAlertSell(string UDSell) { if (!NewBar() || !Use_Sound) return; Alert(Symbol(), " ", Period(), " ", "Sell"); //PlaySound ("Alert2"); } bool NewBar() { static datetime dt = 0; if (dt != Time[0]) { dt = Time[0]; return(true); } }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Does anyone know of an indicator that will send an alert when a candle has posted above or below the upper or lower bollinger bands? I've seen a few that will alert when it crosses but I'm only interested in when a candle posts above or below the upper or lower bollinger bands.