好的,伙计们,我做了更多的学习和研究来找到指数移动平均线的解决方案,下面是有助于计算 ema5 的 EPL 语句
//create a named window EMA5 Window
create window EMA5Window.win:length(1) as select price as ema5 from Quote
//insert the mean of first 5 events
insert into EMA5Window select Avg(price) as ema5 from Quote.win:firstlength(5)
//after 5 events calculate todays ema = (today's price)/3 + (yesterday's ema)*2/3, refer to http://www.iexplain.org/ema-how-to-calculate/ for ema formula
insert into EMA5Window select ((price)*(1/3)+(2/3)*(select ema5 from EMA5Window)) as ema5 from Quote output after 5 events
// now select the ema5 as below
select ema5 as ema5 from EMA5Window output after 5 events
一旦我完成计算抛物线SAR的工作将更新。谢谢