Download MetaTrader 5
To add comments, please log in or register
Find out how to use widgets at MQL5.community
Arkenis
87
Arkenis 2011.11.03 16:42 

Hi,

I'd like to use Bollinger Bands when the chart is in trading range in order to get buy/sell signal when a bar touch the lower/upper band. I want to detect if the chart is in trading range by comparing value of upper band or lower band bar after bar to know if its value is stable or not so I suppose I have to stock iBands results in an array or to use iBandsOnArray() function to stock these values in an array but I don't understand how to use this function..

Could anyone tell me how to do it ?

Thanks.

Ubzen
Moderator
5394
Ubzen 2011.11.03 16:49  
There are lots of examples in the code base.
Arkenis
87
Arkenis 2011.11.03 17:05  

Yeah I know, but all codes I found in the code base just verified if the bar touched the upper or lower band, but it didn't verify if the upper or lower band value was stable in order to know if the chart was in trading range.. it sends signals even if the bands are in a trend.

What I want to do is to stock each value of Bollinger Bands in an array in order to compare them, but if I declare an array in the function, it will be reinitialize each time the function will be called..

Ubzen
Moderator
5394
Ubzen 2011.11.03 17:22  
What do you mean by stable? Do you mean if they're the same or equal to the previous? The values are already in an array equal to the number of periods of the bb. To get this value, use the shift.
Arkenis
87
Arkenis 2011.11.03 17:32  
What do you mean by stable? Do you mean if they're the same or equal to the previous?

Yes, you solved my problem, I didn't understand the shift role when I used the iBands() function.

Thanks a lot !

stan
3
stan 2014.04.21 14:54  
Arkenis:

Yeah I know, but all codes I found in the code base just verified if the bar touched the upper or lower band, but it didn't verify if the upper or lower band value was stable in order to know if the chart was in trading range.. it sends signals even if the bands are in a trend.

What I want to do is to stock each value of Bollinger Bands in an array in order to compare them, but if I declare an array in the function, it will be reinitialize each time the function will be called..


please can u send me on email ewq_ewq@centrum.sk how would a code look like if i want to be alerted if a candle touches a bollinger band?? Please help,thx a lot... the best way would be if u send me the whole script... so u just incorporate that sound alarm into bollinger bands code... thx a lot
/
To add comments, please log in or register