以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://222.73.7.161/bbs/index.asp) -- 公式模型编写问题提交 (http://222.73.7.161/bbs/list.asp?boardid=4) ---- 求助 (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=162486) |
-- 作者:yongle476 -- 发布时间:2018/4/2 21:08:27 -- 求助 请哪位老师帮忙把MC的交易模型改为金字塔的,谢谢!MC模型如下: inputs: lots(1),blenpre(20),blenvol(7),dropstart(10),dropk(4); vars : minpoint(0),myoffset(0),prehp(0),prelp(0),highafterentry(0),loafterentry(0),bopenlong(False),bopenshort(False),mavol(0),dropstartflag(False),atr(0),dropline(0);
minpoint = MinMove*PriceScale; prehp = highest(low,blenpre); prelp = lowest(high,blenpre); mavol = average(v,blenvol); bopenlong = low[1]>=prehp[1] and low[2]>=prelp[2] and high>=high[1]and mavol[1]>=mavol[2]; bopenshort = high[1]<=prelp[1] and high[2]<=prehp[2] and low<=low[1] and mavol[1]>=mavol[2];
atr = AvgTrueRange(14); //kai cang if(bopenlong and marketposition=0) then buy("BPK") next bar at maxlist(open,high[1]) limit; if(bopenshort and marketposition=0) then sellshort("SPK") next bar at minlist(open,low[1]) limit;
//diao deng zhi sun if (marketposition<>0 and barssinceentry>=1) then begin if (barssinceentry>1) then begin highafterentry= maxlist(high[1],highafterentry[1]); loafterentry= minlist(low[1],loafterentry[1]); end else begin highafterentry= maxlist(close[1],entryprice); loafterentry= minlist(close[1],entryprice); end; end; dropstartflag = (highafterentry>=entryprice*(1+dropstart*0.001) or loafterentry<=entryprice*(1-dropstart*0.001));
//zhi sun tiao jian if (marketposition<>0 and barssinceentry>=1) then begin if (marketposition=1) then dropline= highafterentry-dropk*atr[1]; if(low<=dropline and dropstartflag=True) then sell("SP1") next bar at minlist(open,dropline) limit; if (marketposition=-1) then dropline = loafterentry+dropk*atr[1]; if(high>=dropline and dropstartflag=True) then buytocover("BP1") next bar at maxlist(open,dropline) limit; end; |
-- 作者:wenarm -- 发布时间:2018/4/2 23:28:46 -- 抱歉不了解mc的语法函数,。建议你学习pel语言后,自行实现编写。或者提供相应的思路,工作人员可以提供示例代码。 [此贴子已经被作者于2018/4/2 23:30:04编辑过]
|