How to extract the HH part of the candle time?
-
I am trying to extract the HH part of the candle time so as to compare it to a fixed value. Can this be done?
I tried the following but it doesn't work

NB: using the time filter block doesn't work as I want to check candle of previous days
-
Solved. I had ChatGPT write the following code:
When using ChatGPT or Deepseek to write code, mention that it will be used in fxdreema. These 2 AI robots know fxdreema and know how it works
// --- Parse all start and end times into total minutes ---
// Asian
int aStartHour = StringToInteger(StringSubstr(AsianStartTime, 0, 2));
int aStartMinute = StringToInteger(StringSubstr(AsianStartTime, 3, 2));
int aStartTotal = aStartHour * 60 + aStartMinute;int aEndHour = StringToInteger(StringSubstr(AsianEndTime, 0, 2));
int aEndMinute = StringToInteger(StringSubstr(AsianEndTime, 3, 2));
int aEndTotal = aEndHour * 60 + aEndMinute;// Europe
int eStartHour = StringToInteger(StringSubstr(EuropeStartTime, 0, 2));
int eStartMinute = StringToInteger(StringSubstr(EuropeStartTime, 3, 2));
int eStartTotal = eStartHour * 60 + eStartMinute;int eEndHour = StringToInteger(StringSubstr(EuropeEndTime, 0, 2));
int eEndMinute = StringToInteger(StringSubstr(EuropeEndTime, 3, 2));
int eEndTotal = eEndHour * 60 + eEndMinute;// NY
int nStartHour = StringToInteger(StringSubstr(NYStartTime, 0, 2));
int nStartMinute = StringToInteger(StringSubstr(NYStartTime, 3, 2));
int nStartTotal = nStartHour * 60 + nStartMinute;int nEndHour = StringToInteger(StringSubstr(NYEndTime, 0, 2));
int nEndMinute = StringToInteger(StringSubstr(NYEndTime, 3, 2));
int nEndTotal = nEndHour * 60 + nEndMinute;// --- Get the candle time in total minutes ---
datetime candleTime = iTime(Symbol(), tf, candle_id);
int candleHour = TimeHour(candleTime);
int candleMinute = TimeMinute(candleTime);
int candleTotalMinutes = candleHour * 60 + candleMinute;// --- Check all three session windows ---
bool inAsian = (candleTotalMinutes >= aStartTotal && candleTotalMinutes < aEndTotal);
bool inEurope = (candleTotalMinutes >= eStartTotal && candleTotalMinutes < eEndTotal);
bool inNY = (candleTotalMinutes >= nStartTotal && candleTotalMinutes < nEndTotal);// --- Final decision ---
if (inAsian || inEurope || inNY) {
Output = 1;
} else {
Output = 0;
} -
Thank you for sharing.