老师好,下面是期指1分钟交易代码范本,我想在1分钟K线图上分别画出固定止损线和移动止损线,请问代码怎么实现,谢谢:
//中间变量
variable:highprice=0;
win1:=0;
win2:=0;
//交易条件
kd:=kd1 and kd2;
pd:=pd1 and pd2 ;
//交易系统
if kd then begin
sellshort(1,0,limitr,c);
buy(holding=0,1,limitr,c);
highprice:=enterprice;
zs:=enterprice-10;//10点固定止损
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