[求助]請幫忙完善一個漏洞,謝謝 [金字塔]
- 咨詢內(nèi)容:
INPUT:M(26,5,500,30);INPUT:N(2,0.1,10,1);INPUT:X(0.2,0.2,10,0.2);MID : MA(CLOSE,M);UPPER: MID + N*STD(CLOSE,M);LOWER: MID - N*STD(CLOSE,M);多:=ALL(C>O+15*X,2) AND ALL(O>MID,2);空:=ALL(C<O-15*X,2) AND ALL(O<MID,2);
if 多 then begin sellshort(holding<0, 0, thisclose); buy(holding=0 {AND TIME<144000}, 100%, LIMIT); endHH:=HHV(H,BARSLAST(HOLDING<=0));多止損1:HH<Enterprice+60*X AND C<=HH-60*X ,LINETHICK0;多止損2:Enterprice*1.02>=HH AND HH>=Enterprice+60*X AND C<Enterprice+2*X ,LINETHICK0;多止損3:HH>Enterprice*1.02 AND C<HH*0.98 ,LINETHICK0;多止損4:TIME>144000 AND C<Enterprice*1.02 ,LINETHICK0;if 多止損1 OR 多止損2 OR 多止損3 OR 多止損4 then sell(holding>0, 0, thisclose);
if 空 then begin sell(holding>0, 0, thisclose); buyshort(holding=0 {AND TIME<144000}, 100%, thisclose); endLL:=LLV(L,BARSLAST(HOLDING>=0));空止損1:LL>Enterprice-60*X AND C>=LL+60*X ,LINETHICK0;空止損2:Enterprice<=LL*1.02 AND LL<=Enterprice-60*X AND C>Enterprice-2*X ,LINETHICK0;空止損3:LL*1.02<Enterprice AND C*0.98>LL ,LINETHICK0;空止損4:TIME>144000 AND C*1.02>Enterprice ,LINETHICK0;if 空止損1 OR 空止損2 OR 空止損3 OR 空止損4 then sellshort(holding<0, 0, thisclose);
這個程序存在一個問題就是當平倉和開倉同時出現(xiàn)時,只執(zhí)行平倉命令而忽略開倉命令。比如說當前是開空倉中,同時出現(xiàn)平空倉和開多倉信號,系統(tǒng)只執(zhí)行平空倉,卻沒執(zhí)行開多倉。請問應(yīng)該如何修正這個問題?
此主題相關(guān)圖片如下:qq截圖20140122212405.jpg
另外,如果下單價格需要是當前價格的一系列價格,比如當前價是2200點,需要買入2200、2200.2、2200.4、這三個的全部當前賣單,應(yīng)該如何修改程序?
- 金字塔客服:
if 多 then begin
sellshort(holding<0, 0, thisclose);
buy(holding=0 {AND TIME<144000}, 100%, LIMIT);
end
limit后面沒有定義價位
改成thisclose就行
if 多 then begin sellshort(holding<0, 0, thisclose); buy(holding=0 {AND TIME<144000}, 100%, thisclose); end 后面的做不到 - 用戶回復:
非常感謝"jinzhe"的幫助,謝謝!
- 網(wǎng)友回復:
if 多 then begin sellshort(holding<0, 0, thisclose); buy(holding=0 {AND TIME<144000}, 100%, LIMIT); end
若是修改為:
if 多 then begin sellshort(holding<0, 0, limit,close); buy(holding=0 {AND TIME<144000}, 100%, limit,close); end
這樣是否可行呢? - 網(wǎng)友回復:
limit是次周期限價交易,容易因行情波動而變成不成交的價格,所以推薦用limitr,本周期限價交易 if 多 then begin sellshort(holding<0, 0, limitr,close); buy(holding=0 {AND TIME<144000}, 100%, limitr,close); end
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容