金字塔趋势跟踪交易系统
-
相关简介:金字塔公式 金字塔模型策略源码:input:period(60,5,120,5); input:length(20,5,40,5); input:trailingstop(3,1,6,1); variable:stopline=0; topband:=ref(hhv(high,period),1)+mindiff; botband:=ref(llv(low,20),1)-mindiff; atr:=ref(ma(tr,length),1); trailingstopnum:=trimprice(
-
文章来源:公式网 发布时间:2015-10-25浏览次数:
金字塔公式 金字塔模型策略源码:input:period(60,5,120,5);
input:length(20,5,40,5);
input:trailingstop(3,1,6,1);
variable:stopline=0;
topband:=ref(hhv(high,period),1)+mindiff;
botband:=ref(llv(low,20),1)-mindiff;
atr:=ref(ma(tr,length),1);
trailingstopnum:=trimprice(trailingstop*atr);
if holding=0 then begin
if barpos>period and high>=topband then
buy(1,100%,limitr,close);
end
if holding>0 then begin
if high-trailingstopnum>stopline then
stopline:=high-trailingstopnum;
if enterbars>=2 and low<=stopline then begin
sell(1,holding,limitr,close);
stopline:=0;
end
end
partline(holding>0 and enterbars>=2,stopline,coloryellow,1);
盈亏:asset,noaxis,colormagenta;
收益:(asset-500000)/500000,linethick0;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;
复制上述代码粘贴到到公式管理器
源码解析:
输出INPUT:周期
输出INPUT:LENGTH(20,5,40,5)
输出INPUT:TRAILINGSTOP(3,1,6,1)
输出VARIABLE:STOPLINE=0
TOPBAND赋值:昨日周期日内最高价的最高值+MINDIFF


现在就去充值积分
加入VIP可下载100以下的所有资源