咨詢內容://交易系統(tǒng)VARIABLE:AA[]=0;//申明全局變量AA來記錄止損價位,多頭止損if ref((tmpd=1 or (count(bi=-1,2)=1 and count(kx=-1,2)=1)) and (gpd1 or gpd2),1) then begin? ?sellshort(1,holding,marketr);? ?buy(holding=0,ss,marketr);? ?AA:=fl;//開倉后把止損價位賦值AAendastop:=llv(AA,2);IF L<astop-2*MINDIFF then sell(1,holding,marketr);//達到止損位置后平倉,實時止損固定輪詢模式if holding>0 and (pdd=-1 or (enterbars>14 and aspect=1)) then sell(1,holding,marketr); VARIABLE:BB[]=0;//申明全局變量BB來記錄止損價位,空頭止損if ref((tmpk=-1 or (count(bi=1,2)=1 and count(kx=1,2)=1)) and (gpk1 or gpk2),1) then begin? ?sell(1,holding,marketr);? ?buyshort(holding=0,ss,marketr);? ?BB:=fh;//開倉后把止損價位賦值BBend?bstop:=hhv(BB,2);if H>bstop+2*MINDIFF then sellshort(1,holding,marketr);//達到止損位置后平倉,實時止損固定輪詢模式if holding<0 and (pkk=1 or (enterbars>14 and aspect=0)) then sellshort(1,holding,marketr); 上述代碼,實盤有時候出現(xiàn)開平倉不執(zhí)行。 還有一個問題,信號出現(xiàn)時開了倉,但信號出現(xiàn)閃動,但也開了倉的,不能止損平倉。如何處理也開倉單子的止損平倉? 如何編寫?
用戶回復:信號出現(xiàn)時開了倉,后信號出現(xiàn)閃動消失,但賬戶也開了倉的,不能止損平倉。bstop:=hhv(BB,2);if H>bstop+2*MINDIFF then sellshort(1,holding,marketr);//達到止損位置后平倉,實時止損固定輪詢模式這樣止損條件不起作用了。應該如何編寫處理這樣的單子?