Type : Indicator, Name : Variable Volatility Stops
INPUT: LENGTH (21), CONST(3.05);
vaR: SWITCH(1), TR(0), ARC(0), SAR(0),HISIC(0),LOSIC(0);
TR= VOLATILITY (LENGTH);
ARC= TR* CONST;
IF CURRENTbar = length then begin
hisic=c;
losic=c;
if h>= xaverage (h,length-1) [1] then begin
hisic= highest(c,length);
Sar=hisic-arc;
switch= 1;
end;
if l <= xaverage (l,length-1) [1] then begin
losic= lowest (c,length);
sar = losic +arc;
switch=0;
end;
end;
if switch =1 then begin
if c>hisic then hisic=c;
sar=hisic — arc;
if c< sar then begin
switch=0;
losic=c;
sar = losic + arc;
end;
end;
if switch=0 then begin
if c< losic then losic=c;
sar= losic +arc;
if c> sar then begin
switch=1;
hisic=c;
saR=HISIC- ARC;
END;
END;
IF C > SAR { AND C[1] < SAR } THEN
Plot1(SAR,»Sell»);
IF C < SAR { AND C[1] > SAR} THEN
Plot2(sar,»Buy»);