Prevent LE when we're already in a LE
This commit is contained in:
@ -57,6 +57,12 @@ create variable bool InTradingHours = false
|
||||
on TickEvent as t
|
||||
set InTradingHours = EPLHelpers.inTimeRange(t.time, TradingStartTime, TradingEndTime)
|
||||
|
||||
|
||||
--
|
||||
-- In long position. Set later.
|
||||
--
|
||||
|
||||
create variable bool InLongEntry = false
|
||||
|
||||
|
||||
--
|
||||
@ -228,6 +234,7 @@ insert into LongEntryStream
|
||||
and EPLHelpers.laterThan(B2.time, P2.time)
|
||||
and EPLHelpers.laterThan(P1.time, B2.time)
|
||||
and InTradingHours
|
||||
and not InLongEntry
|
||||
|
||||
-- Because multiple streams feed LongEntryStream (CurrentTick,
|
||||
-- MaxHigh3Window, B1, B2...), an event on any of those streams causes
|
||||
@ -246,6 +253,14 @@ insert into LongEntryDistinct
|
||||
from pattern [every-distinct(le.time) le=LongEntryStream]
|
||||
|
||||
|
||||
--
|
||||
-- Long entry derived variables
|
||||
--
|
||||
|
||||
-- Register if We're in a long entry when we get the LongEntryDistinct
|
||||
-- event. (InLongEntry is declared near top of file)
|
||||
on LongEntryDistinct as le set InLongEntry = true
|
||||
|
||||
--
|
||||
-- Event logging
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user