//老师帮我看下这个后台止赢代码是否有问题.我的目的是当黄金浮动盈利达到3点时,后台开始从浮赢3点开始记录价位,如果某价格低于1点后平仓.
if STKLABEL = 'AU00' then 止赢:=3;//ru
//开仓部分
GLOBALVARIABLE:标记=0;
GLOBALVARIABLE:高差价=0;
GLOBALVARIABLE:低差价=0;
多头差:tholding>0 and 标记=0 and HIGH-TAVGENTERPRICE>止赢,LINETHICK0;
空头差:tholding<0 and 标记=0 and TAVGENTERPRICE-LOW>止赢,LINETHICK0;
if 多头差 then begin
高差价:=HIGH;
标记:=1;
end
返多:标记=1 and HIGH>高差价 and tholding>0,LINETHICK0;
高差价:=if(返多,HIGH,ref(高差价,1));
if LOW<高差价-1 and tholding>0 then begin
tsell(1,0,mkt);
标记:=0;
高差价:=0;
end
if 空头差 then begin
低差价:=LOW;
标记:=-1;
end
返空:标记=-1 and LOW<低差价 and tholding<0,LINETHICK0;
低差价:=if(返空,LOW,ref(低差价,1));
if HIGH>低差价-1 and tholding<0 then begin
tsellshort(1,0,mkt);
标记:=0;
低差价:=0;
end
多头价格参:高差价,LINETHICK0;
空头价格参:低差价,LINETHICK0;
老师帮帮忙呀
if 多头差 then begin
高差价:=HIGH;//记录最近的一个满足条件的H
标记:=1;
end
........
高差价:=if(返多,HIGH,ref(高差价,1));
你的高差价本来就是一个全局变量,这里又 出现了ref(高差价,1),你想实现什么目的
高差价:=if(返多,HIGH,ref(高差价,1));
类似这种写法,自身的值又赋值给自己,金字塔不支持这种写法