如何把此代码语句
if islastbar then begin 加到合适的地方可以防止 信号闪烁?
如下代码
runmode:0;
GLOBALVARIABLE: bb=0;
INPUT:N1(0.09,0.01,1,0.01),M(20,1,60,5);
variable:maxprofit=0;//有仓位时最大获利幅度
win:=0;
win2:=0;
H30:=REF(HHV(H,5),1);
L30:=REF(LLV(L,5),1);
H20:=REF(HHV(H,3),1);
L20:=REF(LLV(L,3),1);
开多条件:=c>H30;
开空条件:=c<L30;
平多条件:=c<L20;
平空条件:=c>H20;
if HOLDING=0 then BEGIN//开多单
if 开多条件 then begin
buy(1,1,LIMITR,C);
PLAYSOUND(1,'D:\Program Files (x86)\Sound\KM.wav');
maxprofit:=0;
if islastbar and bb<>barpos then begin
bb:= barpos;
extgbstringSet('QQSTR','C2,开多▲▲▲:'+STKNAME);
VQQM:=QQMSGX(1,close);
end
end
end
if HOLDING=0 then BEGIN//开多单
if 开空条件 then begin
buyshort(1,1,LIMITR,C);
PLAYSOUND(1,'D:\Program Files (x86)\Sound\KM.wav');
maxprofit:=0;
if islastbar and bb<>barpos then begin
bb:= barpos;
extgbstringSet('QQSTR','C2,开空▼▼▼:'+STKNAME);
VQQM:=QQMSGX(1,close);
end
end
end
if HOLDING >0 then BEGIN//开多单
PRICE:=0;
win:=(c-enterprice)/enterprice*100; //记录最大盈利
if win > maxprofit then maxprofit:=win;
win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
if 平多条件 then PRICE:=max(O,C);
if win <-2 then PRICE:=max(O,C);
if PRICE>0 then begin
sell(1,holding,LIMITR,PRICE);
PLAYSOUND(1,'D:\Program Files (x86)\Sound\JB2.wav');
if islastbar and bb<>barpos then begin
bb:= barpos;
extgbstringSet('QQSTR','C2,平多●●●:'+STKNAME);
VQQM:=QQMSGX(1,close);
end
end
end
if HOLDING <0 then BEGIN//开多单
PRICE:=0;
win:=(enterprice-c)/enterprice*100; //记录最大盈利
if win > maxprofit then maxprofit:=win;
win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
if 平空条件 then PRICE:=min(O,C);
if win <-2 then PRICE:=min(O,C);
if PRICE>0 then begin
sellshort(1,holding,LIMITR,PRICE);
PLAYSOUND(1,'D:\Program Files (x86)\Sound\JB2.wav');
if islastbar and bb<>barpos then begin
bb:= barpos;
extgbstringSet('QQSTR','C2,平空◎◎◎:'+STKNAME);
VQQM:=QQMSGX(1,close);
end
end
end
1使用走完k线模式,
2全局变量在代码里面起什么作用?