Add HKStream, TBStream, and TBHKStream

This commit is contained in:
2018-11-14 20:41:28 -08:00
parent a9f9e44651
commit 92c3636d8f

View File

@ -19,6 +19,9 @@ create constant variable DateTime TradingEndTime = EPLHelpers.parseTime("23:59")
-- Example values: '5s', '1m', '1h 30m', '2h', '12h', '1d'. -- Example values: '5s', '1m', '1h 30m', '2h', '12h', '1d'.
create constant variable string OHLCInterval = '10s' 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. -- Amount to be traded, measured in units.
create constant variable int TradeSize = 10 create constant variable int TradeSize = 10
@ -60,16 +63,46 @@ on TickEvent as t
-- A stream of OHLC values calculated from TickEvents -- 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 -- Send every TickEvent to the OHLC plugin. The plugin will post an
-- OHLCEvent to OHLCStream every OHLCInterval amount of time. It uses -- OHLCEvent to OHLCStream every OHLCInterval amount of time. It uses
-- TickEvent.time ("time") as the source of the timestamp, and uses -- TickEvent.time ("time") as the source of the timestamp, and uses
-- TickEvent.midDouble() as the value to use in the OHLC calculation. -- TickEvent.midDouble() as the value to use in the OHLC calculation.
create variant schema OHLCStream as OHLCEvent
insert into OHLCStream insert into OHLCStream
select * from TickEvent#OHLC("OHLC", "time", OHLCInterval, time, midDouble) 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 -- Simple moving average streams