iHighest range issue...

 

I am using a movement range filter of pips over given period, using ihigh and ilow.

When I use 'Comment' to get Range1 it is showing me correct value in terminal. But at the same time it is drawing an arrow on every single bar even though range1 is below points2. What am I doing wrong here....?

        double Range1  = High[iHighest(NULL,0,MODE_HIGH,2,0)] - Low[iLowest(NULL,0,MODE_LOW,2,0)];
        double points2  =  0.0009;
        
        
           if ( Range1 >= points2)
		&&
           
        CrossUp[i]==EMPTY_VALUE) 
           //THEN DRAW ARROW...
        CrossUp[i] = Low[i] - 5*Point*K;

 
fabian waldo: time it is drawing an arrow on every single bar even though range1 is below points2. What am I doing wrong here....?
double Range1  = High[iHighest(NULL,0,MODE_HIGH,2,0)] - Low[iLowest(NULL,0,MODE_LOW,2,0)];
double points2  =  0.0009;
:
CrossUp[i] = ...
  1. If the range for the last two candles is above 9 pips, you draw an arrow at every candle.
  2. Don't hard code numbers, code breaks on JPY pairs. You are not adjusting SL, TP, and slippage; for 4/5 digit brokers and for JPY pairs.
    double   pip          = StringFind(_Symbol,"JPY") < 00.010.0001;
    int      pipsToPoints = int(pip / _Point);
    int      pipDigits    = (int)MathLog10(pipsToPoints);
    int      slippage     = 3 * pipsToPoints;

    double points2  =  9 * pip;
 
whroeder1:
  1. If the range for the last two candles is above 9 pips, you draw an arrow at every candle.
  2. Don't hard code numbers, code breaks on JPY pairs. You are not adjusting SL, TP, and slippage; for 4/5 digit brokers and for JPY pairs.
    double   pip          = StringFind(_Symbol,"JPY") < 00.010.0001;
    int      pipsToPoints = int(pip / _Point);
    int      pipDigits    = (int)MathLog10(pipsToPoints);
    int      slippage     = 3 * pipsToPoints;

    double points2  =  9 * pip;


Thanks for help. I am aware of digits and jpy, and only using this for EUR/USD on 5 digit - so it is not necessary to implement that code right now. 

In regards to 'Crossup[i]' it should only draw an arrow below a candle where previous range of last 2 bars is above 9 pips. However it is drawing it on every bar...

Any other advice/ help much appreciated!! Thanks.

Reason: