trading_system_1.epl: remove obsolete LE-derived values
This commit is contained in:
@ -60,13 +60,6 @@ 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
|
||||
|
||||
|
||||
--
|
||||
-- A stream of OHLC values calculated from TickEvents
|
||||
@ -237,7 +230,6 @@ 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
|
||||
@ -263,51 +255,37 @@ insert into LongEntryDistinct
|
||||
-- Long entry derived values
|
||||
--
|
||||
|
||||
-- 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
|
||||
-- Increment LongEntry StopBarCount on every bar.
|
||||
on OHLCStream
|
||||
update OrderTable
|
||||
set stopBarCount = stopBarCount + 1
|
||||
where OrderTable.open
|
||||
|
||||
-- LongEntryTime contains the timestamp of the last long entry,
|
||||
-- or null if none has happened yet.
|
||||
create variable DateTime LongEntryTime = null
|
||||
|
||||
on LongEntryDistinct as le set LongEntryTime = le.time
|
||||
|
||||
-- LongEntryStopBarCount contains the number of OHLCStream bars that
|
||||
-- have occurred since the most recent long entry.
|
||||
create variable int LongEntryStopBarCount = 0
|
||||
|
||||
-- Reset LongEntryStopBarCount when we get a new LE.
|
||||
on LongEntryDistinct as le set LongEntryStopBarCount = 0
|
||||
|
||||
-- Increment LongEntryStopBarCount on every bar.
|
||||
on OHLCStream as ohlc set LongEntryStopBarCount = LongEntryStopBarCount + 1
|
||||
|
||||
-- LongEntryPrice contains the price of the last long entry,
|
||||
-- or null if none has happened yet.
|
||||
create variable BigDecimal LongEntryPrice = null
|
||||
|
||||
on LongEntryDistinct as le set LongEntryPrice = le.current
|
||||
-- on OHLCStream
|
||||
-- update OrderTable
|
||||
-- set stopBarCount = case when stopBarCount is null then 1 else stopBarCount + 1 end
|
||||
-- where OrderTable.open is not null
|
||||
-- and OrderTable.open
|
||||
|
||||
-- LongEntryPreEntryBar is a stream that keeps bars just prior to the
|
||||
-- last long entry
|
||||
create schema LongEntryPreEntryBar
|
||||
as (time DateTime,
|
||||
open double,
|
||||
high double,
|
||||
low double,
|
||||
close double)
|
||||
-- create schema LongEntryPreEntryBar
|
||||
-- as (time DateTime,
|
||||
-- open double,
|
||||
-- high double,
|
||||
-- low double,
|
||||
-- close double)
|
||||
|
||||
-- Add bars so long as we're not in a long position
|
||||
insert into LongEntryPreEntryBar
|
||||
select time, open, high, low, close from OHLCStream
|
||||
where InLongEntry is false
|
||||
-- -- Add bars so long as we're not in a long position
|
||||
-- insert into LongEntryPreEntryBar
|
||||
-- select time, open, high, low, close from OHLCStream
|
||||
-- where InLongEntry is false
|
||||
|
||||
-- Contains the second-most-recent LongEntryPreEntryBar's "low" value
|
||||
create schema LongEntryPreEntryBarPrevLow (low double)
|
||||
-- -- Contains the second-most-recent LongEntryPreEntryBar's "low" value
|
||||
-- create schema LongEntryPreEntryBarPrevLow (low double)
|
||||
|
||||
insert into LongEntryPreEntryBarPrevLow select prev(1, low) as low
|
||||
from LongEntryPreEntryBar#length(2)
|
||||
-- insert into LongEntryPreEntryBarPrevLow select prev(1, low) as low
|
||||
-- from LongEntryPreEntryBar#length(2)
|
||||
|
||||
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user