Help with coding correct calculation

 

If anyone is able to help me with this calculator. I want the indicator to work only when a candle changes direction at the minimum number of pips. The code I have at the moment works >= the min pips set in both directions. How would I fix to say only when the new close is a bullish close from last close. Thanks again if anyone has the time.


double pips = NormalizeDouble(fabs(close[1]-close[2])/_Point/pip_factor,_Digits);
      if(pips >= PipsMinimumChange)
 
Heb852:

If anyone is able to help me with this calculator. I want the indicator to work only when a candle changes direction at the minimum number of pips. The code I have at the moment works >= the min pips set in both directions. How would I fix to say only when the new close is a bullish close from last close. Thanks again if anyone has the time.


Hello ,

Perhaps you can use something like that .

Set the pip factor in onInit, and the other code, wherever you want

double pip_factor = 1;
if(Digits==3 || Digits==5)
 {pip_factor*=10;}

double pips = NormalizeDouble(fabs(close[1]-close[2])/(_Point*pip_factor),_Digits);

Hope it works for  you !

 
Thanks!