Trailing Stop level indicator

Here you can post and download custom indicators written in JavaScript.

Moderator: admin

Trailing Stop level indicator

Postby Alexander.Gettinger » Sat Mar 30, 2019 4:38 pm

The indicator can be used to calculate the stop levels for trading.

Formulas:
TSL[i] = Max(TSL[i-1], Close[i]-loss), if Close[i]>TSL[i-1] and Close[i-1]>TSL[i-1],
TSL[i] = Min(TSL[i-1], Close[i]+loss), if Close[i]<TSL[i-1] and Close[i-1]<TSL[i-1],
TSL[i] = Close[i]-loss, if Close[i]>TSL[i-1],
TSL[i] = Close[i]+loss, if Close[i]<TSL[i-1], where
loss = Close[i]*Percent/100.

Trailing_Stop_Level.PNG


Download:
Trailing_Stop_Level_JS.jsl
(2.17 KiB) Downloaded 584 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Return to JavaScript Indicators and Strategies

Who is online

Users browsing this forum: No registered users and 8 guests