How to get the pip difference in bollinger band

To add comments, please log in or register
don per
115
don per  

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.

Capture

Andrey Barinov
41952
Andrey Barinov  
don per:

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)

don per
115
don per  
Andrey Barinov:

SymbolInfoDouble(Symbol(),SYMBOL_POINT) 

Thanks for the response. But I didn't understand this function. Help says "Returns the corresponding property of a specified symbol"

It gives me the same result as the function MarketInfo(Symbol(),MODE_TICKSIZE)

mwfx108
9
mwfx108  

You need to divide the bb_diff by the Point value.

double bb_diff_pips = NormalizeDouble(bb_diff / Point, 2);
To add comments, please log in or register