Low overhead swing engine without buy or sell signals.
{111 swing1.14 for black background} var: dir(0), inside(false), longRngH(0), longRngL(0), myBar(0), myH(0), myL(0), offset(0), Si(0); array:s[999,4](0); {s[1999,4](0) will lookback further}
if inside[1] then begin if H>longRngH or L<longRngL then inside=false; if H>longRngH and L>longRngL then dir=1; {up} if H<longRngH and L<longRngL then dir= -1; {down} end else begin if H<=H[1] and L>=L[1] then begin longRngL=L[1]; longRngH=H[1]; inside=true; {inside} end; if H>H[1] and L>L[1] then dir= 1; {up} if H<H[1] and L<L[1] then dir= -1; {down} end;
if inside=false then begin myBar=currentbar; myH=H; myL=L; end;
if dir<>dir[1] then begin si=si+1; s[si,0]=myBar[1]; if dir>0 then s[si,4]=myL[1] else s[si,4]=myH[1]; end;
for offset=currentbar-s[si,0] downto 0 begin if dir<0 then setPlotColor[offset](1,magenta); if dir>0 then setPlotColor[offset](1,blue); end; plot1[currentbar-s[si,0]](s[si,4]); |