Improve trading window - can specify times as "hh:mm"
This commit is contained in:
@ -9,11 +9,11 @@
|
||||
|
||||
-- The time the trading logic will begin to enter trades.
|
||||
-- Exiting trades is 24/7.
|
||||
create constant variable int StartTimeHour = 9
|
||||
create constant variable DateTime TradingStartTime = EPLHelpers.parseTime("00:00")
|
||||
|
||||
-- The time the trading logic will begin to enter trades.
|
||||
-- The time the trading logic will no longer enter trades.
|
||||
-- Exiting trades is 24/7.
|
||||
create constant variable int EndTimeHour = 17
|
||||
create constant variable DateTime TradingEndTime = EPLHelpers.parseTime("23:59")
|
||||
|
||||
-- The time frame for OHLC calculation.
|
||||
-- Example values: '5s', '1m', '1h 30m', '2h', '12h', '1d'.
|
||||
@ -47,14 +47,13 @@ insert into CurrentTickWindow select * from TickEvent
|
||||
--
|
||||
|
||||
-- InTradingHours will be set to true when the current time is between
|
||||
-- StartTime and EndTime.
|
||||
-- TradingStartTime and TradingEndTime.
|
||||
create variable bool InTradingHours = false
|
||||
|
||||
-- Update on each tick
|
||||
-- NOTE: see "timer:within" pattern for possible alternate formulation
|
||||
on TickEvent as t set InTradingHours =
|
||||
(EPLHelpers.getHour(t.time) >= StartTimeHour and
|
||||
EPLHelpers.getHour(t.time) < EndTimeHour)
|
||||
on TickEvent as t
|
||||
set InTradingHours = EPLHelpers.inTimeRange(t.time, TradingStartTime, TradingEndTime)
|
||||
|
||||
|
||||
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user