Download MetaTrader 5
To add comments, please log in or register
Trade like successful traders - subscribe to their signals!
lajcld
14
lajcld 2014.04.28 14:32 

Hi, need for my strategy to count entry price Close from yestrday specific time .

examples Yestrday Close price on 15 min chart at 22:15 bar .

I was traing lot of code but still nothing passed for me .

Thanks for each idea.

whroeder1
13637
whroeder1 2014.04.28 15:03  
stentasch: Yestrday Close price on 15 min chart at 22:15 bar .
string   PriceToStr(double p){   return( DoubleToStr(p, Digits) );            }
#define HR2400 PERIOD_D1 * 60    // 86400 = 24 * 3600
int      TimeOfDay(datetime when=0){      if(when == 0)  when = TimeCurrent();
                                          return( when % HR2400 );            }
datetime DateOfDay(datetime when=0){      if(when == 0)  when = TimeCurrent();
                                          return( when - TimeOfDay(when) );   }
//datetime Tomorrow( datetime when=0){      if(when == 0)  when = TimeCurrent();
//                                          return(DateOfDay(when) + HR2400);   }
datetime Yesterday(datetime when=0){      if(when == 0)  when = TimeCurrent();
   int iD1 = iBarShift(NULL, PERIOD_D1, DateOfDay(when) - 1);
                                       return( iTime(NULL, PERIOD_D1, iD1) ); }
#define HR2215 80100 // 22*3600+15*60
int      iChart = iBarShift(NULL,0, Yesterday()+HR2215);
datetime when   = Time[iChart];
double   price  = Close[iChart];
Print("Close @ ", TimeToStr(when, TIME_DATE|TIME_MINUTES|TIME_SECONDS), "=", PriceToStr(price) );
lajcld
14
lajcld 2014.04.28 16:11  
WHRoeder:

Thank you very much .Working great.
/
To add comments, please log in or register