源码自留。、、、、、、、
爱约股解答:
input:p(1.5,1,4),m(10,3,50);
atr:=if(barssince(c)>=m,ma(tr,m),ema(tr,m));
median:=(high + low)/2;
up:=median + atr*p;
dn:=median - atr*p;
trup:=llv(up,m);
trdn:=hhv(dn,m);
fc:=close;
for i=m+1 to datacount do begin
if fc[i] > trup[i-1] then
tra[i]:=1;else
if fc[i] < trdn[i-1] then
tra[i]:=-1;else
tra[i]:=tra[i-1];
end;
partline(tra=-1,trup),colorblue,linethick2;
partline(tra=1,trdn),colormagenta,linethick2;
趋势跟踪止损线:if(tra=1,trdn,trup),linethick;