// Downloaded From https://www.WiseStockTrader.com
st=Optimize("stop",30,15,35,0.5);
StopLevel = st;



ApplyStop( stopTypeTrailing, stopModePercent, StopLevel, True );
 
Equity( 1, 0 ); // evaluate stops, all quotes

InTrade = Flip( Buy, Sell );

SetOption("EveryBarNullCheck", True );
stopline = IIf( InTrade, HighestSince( Buy, High ) * ( 1 - 0.01 * Stoplevel ), Null );



Plot( stopline, "trailing stop line", colorYellow );

s0=STOPLINE;

s1= s0 > C ;
s2= s0 <C ;