金字塔公式 金字塔模型策略源码:runmode:0;
buycond:=open<ref(low,1);
buyshortcond:=open>ref(high,1);
if holding=0 then begin
if buycond then
buy(1,1,limitr,open);
end
if holding=0 then begin
if buyshortcond then
buyshort(1,1,limitr,open);
end
if holding>0 then begin
sell(1,holding,limitr,close);
end
if holding<0 then begin
sellshort(1,holding,limitr,close);
end
收益:(asset-30000)/30000,noaxis,colormagenta;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;
复制上述代码粘贴到到公式管理器
源码解析:
输出RUNMODE:0
BUYCOND赋值:开盘价<昨日最低价
BUYSHORTCOND赋值:开盘价>昨日最高价
逻辑判断 HOLDING=0 THEN BEGIN 逻辑判断 BUYCOND THEN BUY(1,1,LIMITR,开盘价)
ENDIF HOLDING=0 THEN BEGIN 逻辑判断 BUYSHORTCOND THEN BUYSHORT(1,1,LIMITR,开盘价)
ENDIF HOLDING>0 THEN BEGIN SELL(1,HOLDING,LIMITR,收盘价)
ENDIF HOLDING<0 THEN BEGIN SELLSHORT(1,HOLDING,LIMITR,收盘价)
输出END收益:(ASSET-30000)/30000,NOAXIS,画洋红色
输出次数:TOTALTRADE,线宽为0
输出胜率:PERCENTWIN,线宽为0
输出连亏:MAXSEQLOSS,线宽为0
输出连赢:MAXSEQWIN,线宽为0