what is coding for count today datetime to tomorror datetime?

 

hi,

i've problem when i want to joint yesterday time with today datetime, do i need use this code

double dDay = iCustom(NULL, PERIOD_D1,1);
double D2Day = iCustom(NULL, PERIOD_D1,0);

To get the time & put inside below code? thanks...

  extern string periodBegin    = "23:00"; // yesterday time
  extern string periodEnd      = "01:00"; // today time
  extern string BoxEnd         = "02:00"; // today time

  datetime dtTimeBegin, dtTimeEnd, dtTimeObjEnd;
  double   dPriceHigh,  dPriceLow; 
  int      iBarBegin,   iBarEnd;

  dtTimeBegin = StrToTime(TimeToStr(dtTradeDate, TIME_DATE) + " " + sTimeBegin);
  dtTimeEnd = StrToTime(TimeToStr(dtTradeDate, TIME_DATE) + " " + sTimeEnd);
  dtTimeObjEnd = StrToTime(TimeToStr(dtTradeDate, TIME_DATE) + " " + sTimeObjEnd);
      
  iBarBegin = iBarShift(NULL, 0, dtTimeBegin);
  iBarEnd = iBarShift(NULL, 0, dtTimeEnd);
  dPriceHigh = High[Highest(NULL, 0, MODE_HIGH, iBarBegin-iBarEnd, iBarEnd)];
  dPriceLow = Low [Lowest (NULL, 0, MODE_LOW , iBarBegin-iBarEnd, iBarEnd)];

 

If you're trying to do what I think you trying to do ...

dPriceHigh = iHigh(NULL, PERIOD_D1, 1);
dPriceLow = iLow(NULL, PERIOD_D1, 1);
 
brewmanz:

If you're trying to do what I think you trying to do ...

How about the specific "period time"?

  extern string periodBegin    = "23:00"; // yesterday time
  extern string periodEnd      = "01:00"; // today time
  extern string BoxEnd         = "02:00"; // today time

regards,

MANSTIR

 
// extern string periodBegin    = "23:00"; // yesterday time
// extern string periodEnd      = "01:00"; // today time
extern int hrBegin = 23;
extern int hrEnd   =  1;
for(int iBarEnd   = 0;         TimeHour(Time[iBarEnd])  != hrEnd;   iBarEnd++){}   // Fails TF>H1
for(int iBarBegin = iBarEnd+1; TimeHour(Time[iBarBegin] != hrBegin; iBarBegin++){}
while(                         TimeHour(Time[iBarBegin+1] == hrBegin) iBarBegin++; // Req if TF<H1
dPriceHigh = High[Highest(NULL, 0, MODE_HIGH, iBarBegin-iBarEnd+1, iBarEnd)];
dPriceLow  =  Low[ Lowest(NULL, 0, MODE_LOW , iBarBegin-iBarEnd+1, iBarEnd)];
// ........................................................... ^^
 
WHRoeder:

thank you a lot WHroeder, i will try it...

regards,

MANSTIR

Reason: