(F1) Help : iHighest(...) & iLowest(...) - page 2

 
WHRoeder:
There are not 96 M15 bars in a day when your broker is GMT+0. If it's Sunday, only 8 bars. Don't hard code numbers.
Also works on any chart, not just M15.

Guilty as charged :-(

I always forget there are poor unfortunates who have more than 5 days in their FOREX charts.

 
WHRoeder:
There are not 96 M15 bars in a day when your broker is GMT+0. If it's Sunday, only 8 bars. Don't hard code numbers.
Also works on any chart, not just M15.
If all you want is Hi/Lo then iHigh(D1) will work.

void Pass(int whichday,int Forecast){
   int y=0;
   int LOWt=0;
   int HIGHt=0;
   double Dif=0;
   y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,whichday));
   int ds=y-96;
   for (int u=y-1;u>ds;u--){
      LOWt=Low[iLowest(Symbol(),PERIOD_M15,MODE_LOW,y,u)];
      HIGHt=High[iHighest(Symbol(),PERIOD_M15,MODE_HIGH,y,u)];
      Dif=(HIGHt-LOWt)/Point;
      if(Dif>=Forecst)Break;
      
   }
  
High.A=HIGHt;
Low.A=LOWt;
.
.
.

  
} 
 
dabbler:

Guilty as charged :-(

I always forget there are poor unfortunates who have more than 5 days in their FOREX charts.

void Pass(int whichday,int Forecast){
   int y=0;
   int LOWt=0;
   int HIGHt=0;
   double Dif=0;
   y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,whichday));
   int ds=y-96;
   for (int u=y-1;u>ds;u--){
      LOWt=Low[iLowest(Symbol(),PERIOD_M15,MODE_LOW,y,u)];
      HIGHt=High[iHighest(Symbol(),PERIOD_M15,MODE_HIGH,y,u)];
      Dif=(HIGHt-LOWt)/Point;
      if(Dif>=Forecst)Break;
      
   }
  
High.A=HIGHt;
Low.A=LOWt;
.
.
.

  
} 
 
RaptorUK:
Yep, I agree the count is probably going to be 96 . . . just not sure about the starting point . . . if it is (y-1) then he can use iHigh(NULL, PERIOD_D1, 1) and iLow (NULL, PERIOD_D1, 1)

void Pass(int whichday,int Forecast){
   int y=0;
   int LOWt=0;
   int HIGHt=0;
   double Dif=0;
   y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,whichday));
   int ds=y-96;
   for (int u=y-1;u>ds;u--){
      LOWt=Low[iLowest(Symbol(),PERIOD_M15,MODE_LOW,y,u)];
      HIGHt=High[iHighest(Symbol(),PERIOD_M15,MODE_HIGH,y,u)];
      Dif=(HIGHt-LOWt)/Point;
      if(Dif>=Forecst)Break;
      
   }
  
High.A=HIGHt;
Low.A=LOWt;
.
.
.

  
} 
 
dabbler:

This will probably be closer, but I haven't tried it ...

It is bound to be wrong by ±1 here and there :-)

And of course it will ONLY work on an M15 chart (since you are using High[] in your comment)



RaptorUK:
The size of your array is wrong . . . the High is correct by chance . . . not by design. I assume you are trying to get the high and low during a day ? why not just use iHigh and iLow and PERIOD_D1 ? or am I misunderstanding ?

WHRoeder:
There are not 96 M15 bars in a day when your broker is GMT+0. If it's Sunday, only 8 bars. Don't hard code numbers.
Also works on any chart, not just M15.
If all you want is Hi/Lo then iHigh(D1) will work.

thanks guys,

i find it solution.

double Toll.Pass(int whichday,double Toll){
   int y=0,z=0;
   double LOWt=0;
   double HIGHt=0;
   double Dif=0;
   y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,whichday));
   z=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,(whichday+1)));
   int ds=z-y;//264
   int cunt=ds;
   for (int u=1;u<cunt;u++){
      
      LOWt=Low[iLowest(Symbol(),PERIOD_M15,MODE_LOW,u+1,y+ds-1)];
      HIGHt=High[iHighest(Symbol(),PERIOD_M15,MODE_HIGH,u+1,y+(ds-1))];
      if(((HIGHt-LOWt)/Point)>=Toll)break;
      ds--;
      
   }
//  Comment("Y: "+y+"\nZ: "+z+"\nds : "+(cunt)+"\ny+cunt"+(y+cunt-1)+"\ny: "+(y)+"\nToll: "+Toll+"\nHigh"+HIGHt+"\nLow"+LOWt);
//  return(901);
  
}  

 
cisco:

thanks guys,

i find it solution.

Or you could have done this ? no ? doesn't it do what you want ?

void Toll.Pass(int whichday)
   {

   LOWt = iLow(Symbol(),PERIOD_D1, whichday);
   HIGHt = iHigh(Symbol(),PERIOD_D1, whichday);
  
   }  
 
RaptorUK:

Or you could have done this ? no ? doesn't it do what you want ?


void Toll.Pass(int whichday,double Toll){
   int y=0,z=0;
   LowBar=0;
   HighBar=0;
   double LOWt=0;
   double HIGHt=0;
   double Dif=0;
   y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,whichday));
   z=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,(whichday+1)));
   int ds=z-y;//264
   int cunt=ds;
   for (int u=1;u<cunt;u++){
      
      LowBar=iLowest(Symbol(),PERIOD_M15,MODE_LOW,u+1,y+ds-1);
      HighBar=iHighest(Symbol(),PERIOD_M15,MODE_HIGH,u+1,y+(ds-1));
      LOWt=Low[LowBar];
      HIGHt=High[HighBar];
      if(((HIGHt-LOWt)/Point)>=Toll)break;
      ds--;
   }
}  

void Draw.toll30(){
   if(Show.toll30){
      for(int teda=0;teda<NumberOfDays;teda++){
         double toler=T30.day[teda];
         Toll.Pass(teda,toler);
         if (Time[HighBar]>Time[LowBar]){//bullish
            if((High[HighBar]-(toler*Point))<=High[HighBar] &&(High[HighBar]-(toler*Point))>=Low[LowBar]){
            DrawLine("L15L"+iTime(Symbol(),PERIOD_D1,teda+1),iTime(Symbol(),PERIOD_D1,teda+1),Low[LowBar]+(toler*Point),iTime(Symbol(),PERIOD_D1,teda),Low[LowBar]+(toler*Point),Toll.30,0,OBJ_PERIOD_M15|OBJ_PERIOD_M30);
            }
         }else{
            if (Time[HighBar]<Time[LowBar]){
            if((High[HighBar]-(toler*Point))<=High[HighBar] &&(High[HighBar]-(toler*Point))>=Low[LowBar]){
            DrawLine("L16L"+iTime(Symbol(),PERIOD_D1,teda+1),iTime(Symbol(),PERIOD_D1,teda+1),High[HighBar]-(toler*Point),iTime(Symbol(),PERIOD_D1,teda),High[HighBar]-(toler*Point),Toll.30,0,OBJ_PERIOD_M15|OBJ_PERIOD_M30);}
            }
         }
      }
   }
}
 

You might like to consider using a different variable name when posting on an English speaking forum ...

int cunt=ds;

http://dictionary.reference.com/browse/cunt

Reason: