老師好,下面是期指1分鐘交易代碼范本,我想在1分鐘K線圖上分別畫(huà)出固定止損線和移動(dòng)止損線,請(qǐng)問(wèn)代碼怎么實(shí)現(xiàn),謝謝:
//中間變量
variable:highprice=0;
win1:=0;
win2:=0;
//交易條件
kd:=kd1 and kd2;
pd:=pd1 and pd2 ;
//交易系統(tǒng)
if kd then begin
sellshort(1,0,limitr,c);
buy(holding=0,1,limitr,c);
highprice:=enterprice;
zs:=enterprice-10;//10點(diǎn)固定止損
end
if enterprice-c>=10 then 多損:sell(holding>0,0,limitr,zs);
if holding>0 then begin
if c>highprice then highprice:=c;
win1:=(c-enterprice)/enterprice*100;
win2:=(highprice-c)/(highprice-enterprice)*100;
if win1>0 and win1<=0.88 and win2>40 then begin
多回:sell(1,0,limitr,highprice-(highprice-enterprice)*0.4);
end
if win1>0.88 and win2>20 then begin
多贏:sell(1,0,limitr,highprice-(highprice-enterprice)*0.2);
end
end