cannot get correct price range across a duration

 
double highest,lowest = 0.0;
datetime starttime,endtime;
bool run,order;

int start()
{
   starttime = StrToTime("12:00");
   endtime = StrToTime("14:15");

if(currenttime >= endtime && !run)
   {
      run = true;

      highest = Close[iHighest(NULL,PERIOD_M15,MODE_CLOSE,9,0)];
      lowest = Close[iLowest(NULL,PERIOD_M15,MODE_CLOSE,9,0)];
      
      if(MathAbs((highest-lowest))/Point >= 60)
      {
         Print("Exceeds max range: "+MathAbs(((highest-lowest)/Point)));
         return(0);
      }
         
      order = false;
   }

}

Hi, i am trying to get the highest price from 12:00 to 14:15 but the range seems to be wrong..

the range i keep getting seems to be in the likes of 400+ to 600+, which isn't looking correct to me..

Any idea what i am doing wrong?

 
exge:

Hi, i am trying to get the highest price from 12:00 to 14:15 but the range seems to be wrong..

the range i keep getting seems to be in the likes of 400+ to 600+, which isn't looking correct to me..

Any idea what i am doing wrong?

Could it be that you are using a 5 digit platform? If that's the case you need to divide your result by 10.
 
robofx.org:
Could it be that you are using a 5 digit platform? If that's the case you need to divide your result by 10.


hmm .. not sure what fxcm uses, but it does have decimal places to 5 places...

ok thanks!

 
exge:
Hi, i am trying to get the highest price from 12:00 to 14:15 but the range seems to be wrong..
the range i keep getting seems to be in the likes of 400+ to 600+, which isn't looking correct to me..
if(currenttime >= endtime && !run)
  1. currenttime isn't defined
  2. You want > 60 pips but the code is working with points. On a 5 digit broker a pip is not a point.
    //++++ These are adjusted for 5 digit brokers.
    double  pips2points,    // slippage  3 pips    3=points    30=points
            pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int init(){
        if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    

  3. highest = Close[iHighest(NULL,PERIOD_M15,MODE_CLOSE,9,0)]
    Don't hard code numbers (9,0) use iBarShift to get the start and end (length=end-start+1)
Reason: