## Trailing Stop level indicator

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

### Trailing Stop level indicator

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.lua

Trailing_Limit_Level.lua

Trailing_Stop_Level.lua based strategy.
viewtopic.php?f=31&t=66878
Alexander.Gettinger
FXCodeBase: Confirmed User

Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

### Re: Trailing Stop level indicator

looks good，thanks
tmdabc

Posts: 19
Joined: Sat Oct 17, 2015 11:12 am

### Re: Trailing Stop level indicator

The indicator was revised and updated.

Apprentice
FXCodeBase: Confirmed User

Posts: 24480
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

### Re: Trailing Stop level indicator

Is there any way to incorporate a limit/take profits line into this indicator also?
Phamilton630

Posts: 23
Joined: Mon Feb 12, 2018 12:10 pm

### Re: Trailing Stop level indicator

If a take profit (TP) line component can be added to this indicator, it would then be possible to add a profit loss counter to the top right corner of the chart.

It would measure the pips accumulated in the chart by the continuous SL and TP events.

This would allow the operator to fine tune TP & SL levels to maximise profits and minimise losses

thank you
Phamilton630

Posts: 23
Joined: Mon Feb 12, 2018 12:10 pm

### Re: Trailing Stop level indicator

How we will calculated limit/take profits line?

Apprentice
FXCodeBase: Confirmed User

Posts: 24480
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

### Re: Trailing Stop level indicator

simplest case would be to make it equal but opposite to SL amount of pips
Phamilton630

Posts: 23
Joined: Mon Feb 12, 2018 12:10 pm

### Re: Trailing Stop level indicator

Apprentice
FXCodeBase: Confirmed User

Posts: 24480
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

### Re: Trailing Stop level indicator

ah ok TP never gets hit. Silly me.

Could you please turn the SL indicator into a strategy that can open a trade when SL is hit (a trade in the opposite direction).

Phamilton630

Posts: 23
Joined: Mon Feb 12, 2018 12:10 pm

### Re: Trailing Stop level indicator

Your request is added to the development list under Id Number 4288

Apprentice
FXCodeBase: Confirmed User

Posts: 24480
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Next