重復(fù)開倉問題
作者:金字塔 來源:cxh99.com 發(fā)布時間:2018年08月28日
-
咨詢內(nèi)容:
? 比如:diff 和dea >0 軸,平空開多。小于0軸,平多開空。會出現(xiàn)條件滿足,一直開倉。如何解決開倉后一直持倉待下一信號出現(xiàn),而不是一直開倉。
?
diff:="macd.diff";
dea:="macd.dea";
Long:diff >=0 and dea >=0;
if Long ?then begin
? ? sellshort(holding<0,holding,market);
? ? buy(1,1,market);
? ? ? ? ? ?
end?
short:diff<=0 and dea<=0;
??
if short ?then begin
? ?sell(holding>0,holding,market);
? ?buyshort(1,1,market); ? ?
end
[此貼子已經(jīng)被作者于2017/5/10 19:31:17編輯過]
?
-
金字塔客服:
突然反應(yīng)過來,知道咋做了
diff:="macd.diff";
dea:="macd.dea";
Long:diff >=0 and dea >=0;
short:diff<=0 and dea<=0;
KD:=Long; ? ? ? ? ?
PD:=short;
KK:=short; ? ? ? ? ?
PK:=long; ? ? ? ? ?
平空:SELLSHORT(PK,1,THISCLOSE); ? ? ? ? ? ? ? ??
開多:BUY(KD AND HOLDING=0,1,THISCLOSE); ? ? ? ? ?
平多:SELL(PD,1,THISCLOSE); ? ? ? ? ? ? ? ? ? ? ??
開空:BUYSHORT(KK AND HOLDING=0,1,THISCLOSE);?