怎樣才能將交易信號(hào)正確輸出,以便方便讀取:簡(jiǎn)單的一個(gè)測(cè)試如下:
?
hh:hhv(ref(h,1),2);
ll:llv(ref(l,1),2);
?VARIABLE:FLAG=0;
?
kaiduo:=h>=hh and ref(c,1)>ref(o,1);
kaikong:=l<=ll and ref(c,1)<ref(o,1);
pingduo:=l<=ll-MINDIFF ;
pingkong:=h>=hh+MINDIFF ;
if holding>0 then begin
price:=0;
if pingduo then
price:=min(o,ll-MINDIFF);
if
price>0 and enterbars>=1 then begin
?sell(1,holding,limitr,price);
?if ISLASTBAR and? FLAG=0 then
???? begin
????
???? DEBUGFILE2('C:\TEST.TXT','平多:%.0f',2,1);
????
???? FLAG=1;
???? end
???
?end
end
?
?
?
?
?
if holding=0 then begin
price:=0;
if kaiduo then
?price:=max(o,hh);
?
?if price>0 then begin
?
?buy
(1,1,limitr,price);
?
?if ISLASTBAR and? FLAG=0 then
???? begin
???? DEBUGFILE2('C:\TEST.TXT','開(kāi)多:%.0f',1,1);
????
???? FLAG=1;
?
?end???
end
end
?
我這個(gè)寫(xiě)法是不是有錯(cuò),想用全局變量只輸出一次,但結(jié)果是單根K線不停輸出同一信號(hào)直到下根K線結(jié)束,但我想一個(gè)信號(hào)只輸出一次該怎么實(shí)現(xiàn)?謝謝!
此主題相關(guān)圖片如下:image 1.png
?
?
if EXTGBDATA('bar' ) <> barpos then
BEGIN
你的輸出代碼
EXTGBDATASET(EXTGBDATA('bar' )? ,barpos )
end
?
?
利用ex全局變量去做控制,該使用方式比較高級(jí)用戶需自行先測(cè)試了解函數(shù)使用后靈活掌握