Can anyone correct this bit of code... I NEED to get the Time that the high and low happened on each day. - page 2

 
gavin:


will this give me what i need. The hourly time of the daily low and daily high??

No, this won't even compile.

Check the doc what iHighest/Lowest does and needs, you need to specify a startbar and a period in which one you want find the high/low

Note that on friday and sunday the day has not 24 hours... at least on my broker..

 
int counted_bars=IndicatorCounted();

     //---- check for possible errors
     if(counted_bars<0) return(-1);
     //---- last counted bar will be recounted
     if(counted_bars>0) counted_bars--;
     limit=Bars-counted_bars;
   
   for( i= limit-1; i >=0; i--)
   {
           
  int D1_bar = iBarShift(NULL, PERIOD_D1, Time[i]);

      double High_i=iHigh(NULL, PERIOD_D1, D1_bar);
      double Low_i=iLow(NULL, PERIOD_D1, D1_bar);
      
       datetime Time_High_i=Time[iHighest(NULL,PERIOD_H1,D1_bar)];
       datetime Time_Low_i=Time[iLowest(NULL,PERIOD_H1,D1_bar)];

this is what i have AND IT DOES COMPILE

 

Look at your code and write after each line what it does exactly.

especially here:


//int iHighest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)
datetime Time_High_i=Time[iHighest(NULL,PERIOD_H1,D1_bar)];

You have to figure out the # of the bar where the day ends, and then inspect last 24 bars before on a normal day. 
 
zzuegg:

Look at your code and write after each line what it does exactly.

especially here:


Well i am no expert and have tried to do it myself with no sucess. Dont worry about it.
 

No problem, all i want to do is to give you some hints...

Find out where a day starts and ends, and the use

Time[iHighest(Symbol(),Period(),MODE_HIGH,start-end,end)];

Reason: