[PEL] 复制代码 LC:=REF(CLOSE,1); //取前一根K线的收盘价
VID:=SUM(VOL,2)/((HHV(HIGH,2)-LLV(LOW,2))*100); //2周期成交量相加,除以2周期最高价和最低价的差值乘以100
RC:=(CLOSE-LC)*VID;//收盘价与LC的差值,乘以VID
LONG:=SUM(RC,0); //将所有K线上RC的数值求和
LONGMA1:=SMA(LONG,10,1); //LONG的10个周期内的扩展指数加权移动平均
LONGMA2:=SMA(LONG,20,1); //LONG的20个周期内的扩展指数加权移动平均
LON:LONGMA1-LONGMA2; //LONGMA1与LONGMA2做差
LONGMA:MA(LON,2); //LON的N个周期均值
LONGT:LON,COLORSTICK;
MA5:MA(C,5);
MA120:MA(C,120);
if longt>0 AND CROSS(MA5,MA120) then
begin
sellshort(1,holding,marketr);
buy(holding=0,1,marketr);
end
if longt<0 AND CROSS(MA120,MA5) then
begin
sell(1,holding,marketr);
buyshort(holding=0,1,marketr);
end |