From 92c3636d8ff1a762520d3959cafc29954154fcf2 Mon Sep 17 00:00:00 2001 From: Seth Ladygo Date: Wed, 14 Nov 2018 20:41:28 -0800 Subject: [PATCH] Add HKStream, TBStream, and TBHKStream --- epl/trading_system_1.epl | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/epl/trading_system_1.epl b/epl/trading_system_1.epl index 659face..b0fc9cb 100644 --- a/epl/trading_system_1.epl +++ b/epl/trading_system_1.epl @@ -19,6 +19,9 @@ create constant variable DateTime TradingEndTime = EPLHelpers.parseTime("23:59") -- Example values: '5s', '1m', '1h 30m', '2h', '12h', '1d'. create constant variable string OHLCInterval = '10s' +-- The number of ticks for OHLC TB calculation. +create constant variable int OHLCTicks = 100 + -- Amount to be traded, measured in units. create constant variable int TradeSize = 10 @@ -60,16 +63,46 @@ on TickEvent as t -- A stream of OHLC values calculated from TickEvents -- --- Create the stream to contain OHLCEvents -create variant schema OHLCStream as OHLCEvent - -- Send every TickEvent to the OHLC plugin. The plugin will post an -- OHLCEvent to OHLCStream every OHLCInterval amount of time. It uses -- TickEvent.time ("time") as the source of the timestamp, and uses -- TickEvent.midDouble() as the value to use in the OHLC calculation. + +create variant schema OHLCStream as OHLCEvent + insert into OHLCStream select * from TickEvent#OHLC("OHLC", "time", OHLCInterval, time, midDouble) +-- Send every TickEvent to the OHLC plugin. The plugin will post an +-- OHLCEvent using Heikin-Ashi calculations to HKStream every +-- OHLCInterval amount of time. It uses TickEvent.midDouble() as the +-- value to use in the OHLC calculation. + +create variant schema HKStream as OHLCEvent + +insert into HKStream + select * from TickEvent#OHLC("HeikinAshi", "time", OHLCInterval, time, midDouble) + +-- Send every TickEvent to the OHLC plugin. The plugin will post an +-- OHLCEvent to TBStream every OHLCTicks ticks. It uses +-- TickEvent.time ("time") as the source of the timestamp, and uses +-- TickEvent.midDouble() as the value to use in the OHLC calculation. + +create variant schema TBStream as OHLCEvent + +insert into TBStream + select * from TickEvent#OHLC("HeikinAshi", "ticks", OHLCTicks, time, midDouble) + +-- Send every TickEvent to the OHLC plugin. The plugin will post an +-- OHLCEvent using Heikin-Ashi calculations to TBHKStream every +-- OHLCTicks ticks. It uses TickEvent.midDouble() as the value to use +-- in the OHLC calculation. + +create variant schema TBHKStream as OHLCEvent + +insert into TBHKStream + select * from TickEvent#OHLC("HeikinAshi", "ticks", OHLCTicks, time, midDouble) + -- -- Simple moving average streams