相关标签:肯特纳通道,肯特纳,中美合资肯特系统18tc,突破交易策略,惠比特交易和配种专区,梦三国交易专区,梦三国交易专区速秒,灵缇格力交易专区,中京交易市场下载专区,
金字塔公式 金字塔模型策略源码:
runmode:0;
input:length(20,1,100,1);
input:numatrs(1);
entertime:=time>=093500 and time<=145500;
exittime:=time>=150000;
tprice:=(high+low+close)/3;
avgvalue:=ma(tprice,length);
shiftvalue:=numatrs*ma(tr,length);
upperband:=avgvalue+shiftvalue;
lowerband:=avgvalue-shiftvalue;
longcond:=entertime and high>=trimprice(ref(upperband,1));
longprice:=max(trimprice(ref(upperband,1)),open);
shortcond:=entertime and low<=trimprice(ref(lowerband,1));
shortprice:=min(trimprice(ref(lowerband,1)),open);
if holding=0 then begin
if longcond then
buy(1,1,limitr,longprice);
end
if holding=0 then begin
if shortcond then
buyshort(1,1,limitr,shortprice);
end
if holding>0 then begin
if exittime then
sell(1,holding,limitr,close);
end
if holding<0 then begin
if exittime then
sellshort(1,holding,limitr,close);
end
收益:(asset-500000)/500000,noaxis,colormagenta;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;
源码解析:
输出RUNMODE:0
输出INPUT:LENGTH(20,1,100,1)
输出INPUT:NUMATRS(1)
ENTERTIME赋值:时间>=093500 AND 时间<=145500
EXITTIME赋值:时间>=150000
TPRICE赋值:(最高价+最低价+收盘价)/3
AVGVALUE赋值:TPRICE的LENGTH日简单移动平均
SHIFTVALUE赋值:NUMATRS*真实波幅的LENGTH日简单移动平均
UPPERBAND赋值:AVGVALUE +SHIFTVALUE
LOWERBAND赋值:AVGVALUE-SHIFTVALUE
LONGCOND赋值:ENTERTIME AND 最高价>=TRIMPRICE(昨日UPPERBAND)
LONGPRICE赋值:TRIMPRICE(昨日UPPERBAND)和开盘价的较大值
SHORTCOND赋值:ENTERTIME AND 最低价<=TRIMPRICE(昨日LOWERBAND)
SHORTPRICE赋值:TRIMPRICE(昨日LOWERBAND)和开盘价的较小值
逻辑判断 HOLDING=0 THEN BEGIN 逻辑判断 LONGCOND THEN BUY(1,1,LIMITR,LONGPRICE)
ENDIF HOLDING=0 THEN BEGIN 逻辑判断 SHORTCOND THEN CXH99.COM BUYSHORT(1,1,LIMITR,SHORTPRICE)
ENDIF HOLDING>0 THEN BEGIN 逻辑判断 EXITTIME THEN SELL(1,HOLDING,LIMITR,收盘价)
ENDIF HOLDING<0 THEN BEGIN 逻辑判断 EXITTIME THEN SELLSHORT(1,HOLDING,LIMITR,收盘价)
输出END 收益:(ASSET-500000)/500000,NOAXIS,画洋红色
输出次数:TOTALTRADE,线宽为0
输出胜率:PERCENTWIN,线宽为0
输出连亏:MAXSEQLOSS,线宽为0
输出连赢:MAXSEQWIN,线宽为0