先止損后開倉,一一對應 [金字塔]
-
咨詢內容:
這樣編寫程序順序合理,正確??
pdd:=aq1>=1 and l>fl;
pkk:=aq1>=1 and h<fh;
VARIABLE: ll=0, hh=0, astop=0, bstop=0, temp_ll[]=0, temp_hh[]=0;? //交易系統 ?if enterbars>1 and l<astop -2*MINDIFF and holding>0 then sell(1,0,marketr);//止損止盈,實時出場 ? if h>valuewhen(TYPE(2),hhv(fh,10)) and holding=0 and 倉差>0 then buy(1,ss,marketr);//止損后,再次入場 ?if enterbars>1 and h>bstop +2*MINDIFF and holding<0 then sellshort(1,0,marketr);//止損止盈,實時出場 ? if l<valuewhen(TYPE(4),llv(fl,10)) and holding=0 and 倉差<0 then buyshort(1,ss,marketr);//止損后,再次入場 ?//開多? temp_ll:=llv(l,2); if pdd then begin ? ?sellshort(1,0,marketr); ? ?buy(holding=0 and 倉差>0,ss,marketr); ? ?ll:=temp_ll; end astop:=ll; //開空 temp_hh:=hhv(h,2); if pkk then begin ? ?sell(1,0,marketr); ? ?buyshort(holding=0 and 倉差<0,ss,marketr); ? ?hh:=temp_hh; end bstop:=hh;?
-
金字塔客服:
另外這樣編寫法:
pdd:=aq1>=1 and l>fl;
pkk:=aq1>=1 and h<fh;
//交易系統
temp_ll:=llv(l,2);
if pdd then
begin
? ?sellshort(1,0,marketr);
? ?buy(holding=0 and 倉差>0,ss,marketr);
? ?ll:=temp_ll;
end
?if enterbars>1 and l<ll-2*MINDIFF and holding>0 then sell(1,0,marketr);//止損止盈,實時出場
?if h>valuewhen(TYPE(2),hhv(fh,10)) and holding=0 and 倉差>0 then buy(1,ss,marketr);
temp_hh:=hhv(h,2); if pkk then begin ? ?sell(1,0,marketr); ? ?buyshort(holding=0 and 倉差<0,ss,marketr); ? ?hh:=temp_hh; end ?if enterbars>1 and h>hh+2*MINDIFF and holding<0 then sellshort(1,0,marketr); ?if l<valuewhen(TYPE(4),llv(fl,10)) and holding=0 and 倉差<0 then buyshort(1,ss,marketr);?
?來源:程序化久久網( www.kzuj.com.cn )
-
用戶回復:
關鍵要保證止損一定要執行。
?
-
網友回復:
在線等
?
-
網友回復:
在線等。VIP
此主題相關圖片如下:qq圖片20170520151708.png
客戶
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容