Library "time_filters"
Collection of filters that related with time like sessions and datetime ranges.
All existing session functions I found in the documentation e.g. not na(time(timeframe.period, sessionTimes))
are not suitable for strategies, since the execution of the entries and the exits are delayed by one bar.
Thus I created this library to overcome this small but very important limitation.
is_in_date_range(fromDate, toDate, usefromDate, usetoDate, t)
is_in_date_range - Check if the given time is between the start and end dates
Parameters:
fromDate: - The start date of the valid range
toDate: - The end date of the valid range
usefromDate: - Set to false for an open started range
usetoDate: - Set to false for an open ended range
t: - The time to compare
Returns: series of bool whether or not the time is inside the datetime range
is_in_session(useSessionStart, sessionStartHour, sessionStartMinute, useSessionEnd, sessionEndHour, sessionEndMinute, useSessionDay, mon, tue, wed, thu, fri , sat, sun, t)
is_in_session - Check if the given time is inside the session as defined by the input params
Parameters:
useSessionStart: - Set to false for an open started session
sessionStartHour: - Session starting hour
sessionStartMinute: - Session starting minute
useSessionEnd: - Set to false for an open ended session
sessionEndHour: - Session ending hour
sessionEndMinute: - Session ending minute
useSessionDay: - Set to false if the day of the weak doesn't matter
mon: - Is the Monday a session day?
tue: - Is the Tuesday a session day?
wed: - Is the Wednesday a session day?
thu: - Is the Thursday a session day?
fri: - Is the Friday a session day?
sat: - Is the Saturday a session day?
sun: - Is the Sunday a session day?
t: - The time to compare.
Returns: series of bool whether or not the time is inside the session
Collection of filters that related with time like sessions and datetime ranges.
All existing session functions I found in the documentation e.g. not na(time(timeframe.period, sessionTimes))
are not suitable for strategies, since the execution of the entries and the exits are delayed by one bar.
Thus I created this library to overcome this small but very important limitation.
is_in_date_range(fromDate, toDate, usefromDate, usetoDate, t)
is_in_date_range - Check if the given time is between the start and end dates
Parameters:
fromDate: - The start date of the valid range
toDate: - The end date of the valid range
usefromDate: - Set to false for an open started range
usetoDate: - Set to false for an open ended range
t: - The time to compare
Returns: series of bool whether or not the time is inside the datetime range
is_in_session(useSessionStart, sessionStartHour, sessionStartMinute, useSessionEnd, sessionEndHour, sessionEndMinute, useSessionDay, mon, tue, wed, thu, fri , sat, sun, t)
is_in_session - Check if the given time is inside the session as defined by the input params
Parameters:
useSessionStart: - Set to false for an open started session
sessionStartHour: - Session starting hour
sessionStartMinute: - Session starting minute
useSessionEnd: - Set to false for an open ended session
sessionEndHour: - Session ending hour
sessionEndMinute: - Session ending minute
useSessionDay: - Set to false if the day of the weak doesn't matter
mon: - Is the Monday a session day?
tue: - Is the Tuesday a session day?
wed: - Is the Wednesday a session day?
thu: - Is the Thursday a session day?
fri: - Is the Friday a session day?
sat: - Is the Saturday a session day?
sun: - Is the Sunday a session day?
t: - The time to compare.
Returns: series of bool whether or not the time is inside the session
Notas de Lançamento:
v2 Invert the background grey out color so that the fade out means not filter approval
Notas de Lançamento:
v3
Added the ability to use specific timezone if needed and not the exchange timezone!
Updated:
is_in_date_range(usefromDate, fromDate, usetoDate, toDate, useTimezone, timezone, t)
is_in_date_range - Check if the given time is between the start and end dates
Parameters:
usefromDate: - Set to false for an open started range
fromDate: - The start date of the valid range
usetoDate: - Set to false for an open ended range
toDate: - The end date of the valid range
useTimezone: - Set to true for a spesific timezone of reference
timezone: - The timezone of reference
t: - The time to compare in UNIX format
Returns: series of bool whether or not the time is inside the datetime range
is_in_session(useSessionStart, sessionStartHour, sessionStartMinute, useSessionEnd, sessionEndHour, sessionEndMinute, useSessionDay, mon, tue, wed, thu, fri, sat, sun, useTimezone, timezone, t)
is_in_session - Check if the given time is inside the session as defined by the input params
Parameters:
useSessionStart: - Set to false for an open started session
sessionStartHour: - Session starting hour
sessionStartMinute: - Session starting minute
useSessionEnd: - Set to false for an open ended session
sessionEndHour: - Session ending hour
sessionEndMinute: - Session ending minute
useSessionDay: - Set to false if the day of the weak doesn't matter
mon: - Is the Monday a session day?
tue: - Is the Tuesday a session day?
wed: - Is the Wednesday a session day?
thu: - Is the Thursday a session day?
fri: - Is the Friday a session day?
sat: - Is the Saturday a session day?
sun: - Is the Sunday a session day?
useTimezone: - Set to true for a spesific timezone of reference
timezone: - The timezone of reference
t: - The time to compare in UNIX format.
Returns: series of bool whether or not the time is inside the session
Added the ability to use specific timezone if needed and not the exchange timezone!
Updated:
is_in_date_range(usefromDate, fromDate, usetoDate, toDate, useTimezone, timezone, t)
is_in_date_range - Check if the given time is between the start and end dates
Parameters:
usefromDate: - Set to false for an open started range
fromDate: - The start date of the valid range
usetoDate: - Set to false for an open ended range
toDate: - The end date of the valid range
useTimezone: - Set to true for a spesific timezone of reference
timezone: - The timezone of reference
t: - The time to compare in UNIX format
Returns: series of bool whether or not the time is inside the datetime range
is_in_session(useSessionStart, sessionStartHour, sessionStartMinute, useSessionEnd, sessionEndHour, sessionEndMinute, useSessionDay, mon, tue, wed, thu, fri, sat, sun, useTimezone, timezone, t)
is_in_session - Check if the given time is inside the session as defined by the input params
Parameters:
useSessionStart: - Set to false for an open started session
sessionStartHour: - Session starting hour
sessionStartMinute: - Session starting minute
useSessionEnd: - Set to false for an open ended session
sessionEndHour: - Session ending hour
sessionEndMinute: - Session ending minute
useSessionDay: - Set to false if the day of the weak doesn't matter
mon: - Is the Monday a session day?
tue: - Is the Tuesday a session day?
wed: - Is the Wednesday a session day?
thu: - Is the Thursday a session day?
fri: - Is the Friday a session day?
sat: - Is the Saturday a session day?
sun: - Is the Sunday a session day?
useTimezone: - Set to true for a spesific timezone of reference
timezone: - The timezone of reference
t: - The time to compare in UNIX format.
Returns: series of bool whether or not the time is inside the session
Notas de Lançamento:
v4
Better explain the timezone offset from the exchange timezone.
Updated:
is_in_date_range(usefromDate, fromDate, usetoDate, toDate, useTimezone, timezone, t)
is_in_date_range - Check if the given time is between the start and end dates
Parameters:
usefromDate: - Set to false for an open started range
fromDate: - The start date of the valid range
usetoDate: - Set to false for an open ended range
toDate: - The end date of the valid range
useTimezone: - Set to true for a spesific timezone of reference
timezone: - The timezone of reference
t: - The time to compare in UNIX format
Returns: series of bool whether or not the time is inside the datetime range
is_in_session(useSessionStart, sessionStartHour, sessionStartMinute, useSessionEnd, sessionEndHour, sessionEndMinute, useSessionDay, mon, tue, wed, thu, fri, sat, sun, useTimezone, timezone, t)
is_in_session - Check if the given time is inside the session as defined by the input params
Parameters:
useSessionStart: - Set to false for an open started session
sessionStartHour: - Session starting hour
sessionStartMinute: - Session starting minute
useSessionEnd: - Set to false for an open ended session
sessionEndHour: - Session ending hour
sessionEndMinute: - Session ending minute
useSessionDay: - Set to false if the day of the weak doesn't matter
mon: - Is the Monday a session day?
tue: - Is the Tuesday a session day?
wed: - Is the Wednesday a session day?
thu: - Is the Thursday a session day?
fri: - Is the Friday a session day?
sat: - Is the Saturday a session day?
sun: - Is the Sunday a session day?
useTimezone: - Set to true for a spesific timezone of reference
timezone: - The timezone of reference
t: - The time to compare in UNIX format.
Returns: series of bool whether or not the time is inside the session
Better explain the timezone offset from the exchange timezone.
Updated:
is_in_date_range(usefromDate, fromDate, usetoDate, toDate, useTimezone, timezone, t)
is_in_date_range - Check if the given time is between the start and end dates
Parameters:
usefromDate: - Set to false for an open started range
fromDate: - The start date of the valid range
usetoDate: - Set to false for an open ended range
toDate: - The end date of the valid range
useTimezone: - Set to true for a spesific timezone of reference
timezone: - The timezone of reference
t: - The time to compare in UNIX format
Returns: series of bool whether or not the time is inside the datetime range
is_in_session(useSessionStart, sessionStartHour, sessionStartMinute, useSessionEnd, sessionEndHour, sessionEndMinute, useSessionDay, mon, tue, wed, thu, fri, sat, sun, useTimezone, timezone, t)
is_in_session - Check if the given time is inside the session as defined by the input params
Parameters:
useSessionStart: - Set to false for an open started session
sessionStartHour: - Session starting hour
sessionStartMinute: - Session starting minute
useSessionEnd: - Set to false for an open ended session
sessionEndHour: - Session ending hour
sessionEndMinute: - Session ending minute
useSessionDay: - Set to false if the day of the weak doesn't matter
mon: - Is the Monday a session day?
tue: - Is the Tuesday a session day?
wed: - Is the Wednesday a session day?
thu: - Is the Thursday a session day?
fri: - Is the Friday a session day?
sat: - Is the Saturday a session day?
sun: - Is the Sunday a session day?
useTimezone: - Set to true for a spesific timezone of reference
timezone: - The timezone of reference
t: - The time to compare in UNIX format.
Returns: series of bool whether or not the time is inside the session
Notas de Lançamento:
v5
Use source and destination timezones to set the reference and the charts timezones for the conversion if needed. Also use the IANA style of timezones that include the daylight saving for each location
Use source and destination timezones to set the reference and the charts timezones for the conversion if needed. Also use the IANA style of timezones that include the daylight saving for each location