Date & time
Extract parts of a time value (for example a candle time) with
HOUR, MINUTE, SECOND, DOD (day of month), MONTH, YEAR, DAYOFWEEK, DATE.
int hour = HOUR(CandleTime(nifty, M1, 0));
int dow = DAYOFWEEK(CandleTime(nifty, M1, 0));
// only trade inside the session
if (hour >= 9 && hour < 15) {
// ...
}Weekday helpers are also available as functions, e.g. GetWeekDayOpen(symbol, "D1"),
GetWeekDayHigh/Low/Close(...), GetPreviousWeekDayClose(...) and
GetTodayDayName().
Ready to run this? Build and backtest strategies in the SutraLipi algo trading platform — no-code builder, tick-level backtesting and one-click live execution. Browse all documentation topics.