But in exploration, the function Gapup() will scan the last created candle at a given time and not the first candle created on that day. My requirement is the later one.
To summarize, I need to write a code which explicitly scans the first candle created of all stocks which hasn't opened in gap up.
Evidently from its description as Previously posted by PanoS:
A gap up occurs if yesterday's high is less than today's low.
Since, the Periodicity of your Analysis is less than Daily, this might help:
NewDay = Day() != Ref( Day(), -1 );
/*
//Or
bi = BarIndex();
NewDay = bi == TimeFrameExpand( TimeFrameCompress( bi, inDaily, compressOpen ), inDaily, expandFirst );
*/
YstrdDayH = TimeFrameGetPrice( "H", inDaily, -1, expandFirst );
LowOfTodaysFirstBar = ValueWhen( NewDay, L );
//If the code compares Today's Low to Previous Day's High using in-built GapUp(),
//it is no longer validating the Days First Bar as the Day progresses, is it?
GapUpCond = YstrdDayH < LowOfTodaysFirstBar;
You can set your own conditions for a Gap Up or Down!