The HamSessionTest is a function that is included in the HamRadar01 package.
This function is used by some of the HamRadar01 indicators, but you can also use it in your own code.
The purpose of this function is to determine whether two bars on an intraday chart are in
the same trading session. This function should be used only on an intraday chart - it
doesn't make sense to compare bars on daily, weekly, or monthly charts because they will
always be in different sessions. For equities, the normal trading hours are 9:30 AM to 4:00
PM. However, e-mini's like ES and NQ trade in a session from 4:45 PM to 4:15 PM, crossing midnight.
You may also want to include pre-market and post-market trading sessions for equities. For example,
you may want to display Bollinger Bands, but only after ALL of the data points are from
"today" - thus skipping the big Bollinger bubble that happens on session open gaps. This
function is used in the Ham Gap Indicator to identify the first bar of a session (and then
determine if these was a gap in opening price).
The prototype of this function is:
HamSessionTest (Dates, Times, StartSession, EndSession, OffsetFirst, OffsetLast);
Return value: integer - 0 if the two bars are in the same session, otherwise non-zero
Parameters: