Here is the formula for a simple Trailing stop indicator

The formula draws a stoploss loss line which will be 7% below the highest close within a lookback period of 20 bars.

The Stoploss % and the Lookback period can be varied. When you plot the indicator you will be prompted for Look back period and Stoploss%. The defaults are set to 20 bars and 7%.

LB:= Input("Enter lookback period",15,30,20);
PERIOD:= Input("ENTER % STOPLOSS",2,10,7);