策略如下,信號(hào)執(zhí)行方式是出信號(hào)立即執(zhí)行,不復(fù)核。
原策略在建倉后最多允許加倉3次,然后一次性平倉。
A為多頭建倉條件
A1為多頭加倉條件
A2為多頭清倉條件
B為空頭建倉條件
B1為空頭加倉條件
B2為空頭清倉條件
BKVOL=0 AND SKVOL=0 AND A AND NOT(ISLASTSK OR ISLASTBK),BK((MONEY*0.005)/(ATR*300));
BKVOL>0 AND A1 AND ISLASTBK,BK((MONEY*0.005)/(ATR*300));
BKVOL>0 AND A1 AND ISLASTBK,BK((MONEY*0.005)/(ATR*300));
BKVOL>0 AND A1 AND ISLASTBK,BK((MONEY*0.005)/(ATR*300));
A2 AND ISLASTBK,SP(BKVOL);
BKVOL=0 AND SKVOL=0 AND B AND NOT(ISLASTSK OR ISLASTBK),SK((MONEY*0.005)/(ATR*300));
SKVOL>0 AND B1 AND ISLASTSK,SK((MONEY*0.005)/(ATR*300));
SKVOL>0 AND B1 AND ISLASTSK,SK((MONEY*0.005)/(ATR*300));
SKVOL>0 AND B1 AND ISLASTSK,SK((MONEY*0.005)/(ATR*300));
B2 AND ISLASTSK,BP(SKVOL);
我想修改一下,達(dá)到以下效果:
以多頭為例,如果無加倉行為,滿足A2時(shí),執(zhí)行平倉。
如果出現(xiàn)加倉行為,則滿足A3時(shí),執(zhí)行平倉。
也就是說,針對(duì)策略是否有加倉行為,執(zhí)行不同的平倉條件。
您的模型采用的是資金比例 所以暫無法判斷是否有加倉行為
如果您使用的是固定手?jǐn)?shù) 那么是可以判斷的 比如您每次下單一手 那么如果當(dāng)前的BKVOL=2那么就必然可以判斷發(fā)生過加倉 可是您用的是資金比例 那么就不好判斷了 您考慮下吧。
信號(hào)執(zhí)行方式是出信號(hào)就執(zhí)行,不復(fù)核。
假定A為開多的條件,BK信號(hào)至少要距上個(gè)SP信號(hào)兩根K線,如下寫正確嗎?
barssp+1>=2 and A,bk;
barssp>2 and A,bk;
BARSSP>2即可實(shí)現(xiàn) 無需+1
僅供參考!
N1:=BARSLAST(DATE<>REF(DATE,1))+1;
TODAYO:=REF(O,N1-1);
TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR,N),NODRAW;
MA5:=MA(C,5),NODRAW;
MA20:=MA(C,20),NODRAW;
A:=C>TODAYO AND MA5>MA20 AND BARSSP>2;//多頭建倉
A1:=C-BKPRICE>2*ATR;//多頭加倉
A2:=BKHIGH-C>1*ATR;//多頭清倉
B:=C<TODAYO AND MA5<MA20 AND BARSBP>2;//空頭建倉
B1:=SKPRICE-C>2*ATR;//空頭加倉
B2:=C-SKLOW>1*ATR;//空頭清倉
CLOSEMINUTE>=10 AND BKVOL=0 AND SKVOL=0 AND A AND NOT(ISLASTSK OR ISLASTBK),BK((MONEY*0.005)/(ATR*300));
CLOSEMINUTE>=10 AND BKVOL>0 AND A1 AND ISLASTBK,BK((MONEY*0.005)/(ATR*300));
CLOSEMINUTE>=10 AND BKVOL>0 AND A1 AND ISLASTBK,BK((MONEY*0.005)/(ATR*300));
CLOSEMINUTE>=10 AND BKVOL>0 AND A1 AND ISLASTBK,BK((MONEY*0.005)/(ATR*300));
A2 AND ISLASTBK,SP(BKVOL);
CLOSEMINUTE>=10 AND BKVOL=0 AND SKVOL=0 AND B AND NOT(ISLASTSK OR ISLASTBK),SK((MONEY*0.005)/(ATR*300));
CLOSEMINUTE>=10 AND SKVOL>0 AND B1 AND ISLASTSK,SK((MONEY*0.005)/(ATR*300));
CLOSEMINUTE>=10 AND SKVOL>0 AND B1 AND ISLASTSK,SK((MONEY*0.005)/(ATR*300));
CLOSEMINUTE>=10 AND SKVOL>0 AND B1 AND ISLASTSK,SK((MONEY*0.005)/(ATR*300));
B2 AND ISLASTSK,BP(SKVOL);
CLOSEMINUTE<=5,CLOSEOUT;
IF,10min周期,信號(hào)執(zhí)行方式是出信號(hào)立即執(zhí)行,不復(fù)核?;販y(cè)無信號(hào)。去掉BARSSP>2和BARSBP>2這個(gè)條件,就變正常了。
BARSSP>2和BARSBP>2的意思是:開倉k線至少距離上次平倉k線2個(gè)周期。不知道這么寫是否正確?