I am trying to get the pip difference between the higher and lower bollinger bands in my code. I am using the following code for this.
double bolinger_upper_band=iBands(NULL,0,bPeriod,Deviation,Shift,Appliedto,MODE_UPPER,1);
double bolinger_lower_band=iBands(NULL,0,bPeriod,Deviation,Shift,Appliedto,MODE_LOWER,1);
double bolinger_main_band=iBands(NULL,0,bPeriod,Deviation,Shift,Appliedto,MODE_MAIN,1);
double bb_diff = (bolinger_upper_band - bolinger_lower_band);
If my upper bb = 1.1588533 and lower bb = 1.1528046 then the difference comes as 0.0060486
I want to convert this into pips. The pip value for the above is 60. I would like to know how to do this based on the currency pair. Don't want to hard code it into different pairs. Any help is appreciated.
Following is a screen shot of the BB values.
SymbolInfoDouble(Symbol(),SYMBOL_POINT)
You need to divide the bb_diff by the Point value.
double bb_diff_pips = NormalizeDouble(bb_diff / Point, 2);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to get the pip difference between the higher and lower bollinger bands in my code. I am using the following code for this.
double bolinger_upper_band=iBands(NULL,0,bPeriod,Deviation,Shift,Appliedto,MODE_UPPER,1);
double bolinger_lower_band=iBands(NULL,0,bPeriod,Deviation,Shift,Appliedto,MODE_LOWER,1);
double bolinger_main_band=iBands(NULL,0,bPeriod,Deviation,Shift,Appliedto,MODE_MAIN,1);
double bb_diff = (bolinger_upper_band - bolinger_lower_band);
If my upper bb = 1.1588533 and lower bb = 1.1528046 then the difference comes as 0.0060486
I want to convert this into pips. The pip value for the above is 60. I would like to know how to do this based on the currency pair. Don't want to hard code it into different pairs. Any help is appreciated.
Following is a screen shot of the BB values.