Control X axis direction, left or right

Building simple Guppy CBL Trail Stop:

//Trail stop***************************************************

i=lastvalue(Cum(1)-1);         //Or: lastvalue(barcount-1)
BTs1=LastValue(BarsSince(H>H[i]));

BTs2=LastValue(barssince(L<L[i-BTs1]));

BTs3=LastValue(BarsSince(L<L[i-BTs2]));

BTstop=LineArray(i-BTs3,L[i-BTs3],BTs1,L[i-BTs3],1);
//Plot(BTstop,"Tstop",colorred,styledots);

Plot(H[i-BTs1],"",colorYellow,styleDashed);
Plot(L[i-BTs1],"",colorGreen,styleLine);
Plot(L[i-BTs2],"",colorBlue, styleDots);
Plot(L[i-BTs3],"",colorOrange, styleDots);

s1: OK
S2: Poblem-Moves to lower bar to the right of s1, which is often lower than then the lower bars to the left.

Any way to control direction (left or right) of code. Need to move only to bars left of s1.
Thank you.

1 Like