HHV(H,ENTERBARS+1); LLV(L,ENTERBARS+1); |
开仓以来最高点和最低点,到平仓就停止.
此处以多头开仓以来最高点为例,最低价请自行补充完善
variable:h1=drawnull;//开多后最高价
ma5:ma(c,5);
ma20:ma(c,20);
if cross(ma5,ma20) and holding=0 then
begin
buy(1,1,marketr);
h1:=high;
end
if holding>0 and high>h1 then h1:=high;//开仓后的最高价
if cross(ma20,ma5) and holding>0 then
begin
sell(1,1,marketr);
end
hh:h1;