[求助]求老師指正錯誤之處,策略區(qū)沒人回答無人值班嗎不?急。。 [金字塔]
- 咨詢內容:
圖表交易
參照論壇示例,寫了一套止損、止盈策略, 老師們請批改以下策略語法是否正確。附合多條件開多,但開倉策略錯誤,導致止盈后符合多條件又開多倉,再止再開,重復輪回,請求正確寫法。
variable:maxprofit=0,qc=0;exittime:=time>=145000;
ND:```````````; XD:```````````;
平空開多條件:=ND>XD;平多開空條件:=ND<XD;
錯誤策略語句,求助修正。[buycond:=count(平空開多條件,0);if holding=0 and buycond then begin buy(1,1,MARKET); maxprofit:=0; end ]
//限時清倉if exittime then begin sell(1,0,MARKET); sellshort(1,0,MARKET); qc:=0;end
//多倉止損 if holding>0 and low<enterprice-3 then sell(1,0,market);
//預設性條件止盈win:=0;ht:=0;if holding > 0 and enterbars > 0 thenbegin win:=(high-enterprice); //記錄多倉浮動盈利 if win > maxprofit then maxprofit:=win; //最大獲利 ht:=maxprofit-win; //最大盈利后的回調幅度end
if maxprofit<3 and holding>0 then 平多:SELL(平多開空條件,0,market);// 盈利小于3點,采用指標平倉。
if maxprofit>=3 and maxprofit<10 and holding>0 then 止贏1:SELL(ht<1+0.1*(maxprofit-2),0,market); // 3至10點盈利保護1點幾利潤盈平
if maxprofit>=10 and maxprofit<20 and holding>0 then 止贏2:SELL(ht<0.5*maxprofit,0,market); // 10至20點盈利保50%浮盈利潤盈平
if maxprofit>=20 and maxprofit<40 and holding>0 then 止贏3:SELL(ht<maxprofit-10,0,market); // 20點至40點盈利,浮盈回撤10點盈平
if maxprofit>40 and holding>0 then 止贏4:SELL(ht<maxprofit-5 or 平多開空條件,0,market); // 大于40點盈利,浮盈回撤5點或指標平倉,哪個先達到執(zhí)行哪個
關于SELL()里面的maxprofit,這里三種用法{1+0.1*(maxprofit-2)}{0.5*maxprofit}{maxprofit-10}是否正確?為什么要在前面加上“ht<”呢?
另外止盈止損后滿足某條件之后重新恢復持倉策略怎么寫?例:即持多倉時,如果止盈(止損)后,趨勢沒有向空條件發(fā)展,在仍然保持多條件情況下,價格重新回調到大于止盈價(止損價)時,重新恢復持多倉。不可行,即放棄。
請老師幫修改一個上述完整策略。
開平空倉盈損,是否是將上述策略中的low,high和開平空改一下即可?還有什么要改變的嗎? - 金字塔客服:
我去看看
- 用戶回復:
jin版,策略版有回復,還是不行。
- 網(wǎng)友回復:
buycond:=count(平空開多條件,0);
這個啥意思?為了實現(xiàn)什么目的?
正是因為錯誤啊,沒法實現(xiàn)策略。所以請求正確的寫法。再發(fā)一遍吧,漏了。
variable:maxprofit=0,qc=0,win:=0,ht:=0;
exittime:=time>=145000;
ND:stkindi('','A',0,22,45);
XD:stkindi('',''B,0,11,0);
平空開多條件:=ND>XD;
平多開空條件:=ND<XD;
if holding=0 and 平空開多條件 then
begin
buy(1,1,MARKET);
maxprofit:=0;
end
//限時清倉
if exittime then begin
sell(1,0,MARKET);
sellshort(1,0,MARKET);
qc:=0;
end
//多倉止損
if holding>0 and low<enterprice-3 then sell(1,1,market);
win:=0;
ht:=0;
if holding > 0 and enterbars > 0 then
begin
win:=(high-enterprice); //記錄多倉浮動盈利
if win > maxprofit then
maxprofit:=win; //最大獲利
ht:=maxprofit-win; //最大盈利后的回調幅度
end
if maxprofit<3 and holding>0 then 平多:SELL(平多開空條件,0,market);// 盈利小于3點,采用指標平倉。
if maxprofit>=3 and maxprofit<10 and holding>0 then 止贏1:SELL(ht<1+0.1*(maxprofit-2),0,market); // 3至10點盈利保護1點幾利潤盈平
if maxprofit>=10 and maxprofit<20 and holding>0 then 止贏2:SELL(ht<0.5*maxprofit,0,market); // 10至20點盈利保50%浮盈利潤盈平
if maxprofit>=20 and maxprofit<40 and holding>0 then 止贏3:SELL(ht<maxprofit-10,0,market); // 20點至40點盈利,浮盈回撤10點盈平
if maxprofit>40 and holding>0 then 止贏4:SELL(ht<maxprofit-5 or 平多開空條件,0,market); // 大于40點盈利,浮盈回撤5點或指標平倉,哪個先達到執(zhí)行哪個
關于SELL()里面的maxprofit,這里三種用法{1+0.1*(maxprofit-2)}{0.5*maxprofit}{maxprofit-10}是否正確?為什么要在前面加上“ht<”呢?
另外止盈止損后滿足某條件之后重新恢復持倉策略怎么寫?例:即持多倉時,如果止盈(止損)后,趨勢沒有向空條件發(fā)展,在仍然保持多條件情況下,價格重新回調到大于止盈價(止損價)時,重新恢復持多倉。不可行,即放棄。
請老師幫修改一個上述完整策略。
開平空倉盈損,是否是將上述策略中的low,high和開平空改一下即可?還有什么要改變的嗎?
[此貼子已經(jīng)被作者于2014/3/13 17:28:57編輯過] - 網(wǎng)友回復: 不是你的思路是什么?這個開倉條件為什么要這么寫?
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯(lián)系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容