-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSource-Code
More file actions
20 lines (15 loc) · 716 Bytes
/
Source-Code
File metadata and controls
20 lines (15 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © zeubetella
//@version=5
indicator("Trailing Stop", overlay = true)
input_01 = input.int(2,
title = "Number of occurrences of the condition",
minval = 1,
step = 1,
tooltip = "How many times should the condition 'Low Value < Previous Low Value' be met for the line color to turn red?")
trail_cond = low > low[1]
trail_stop = ta.valuewhen(trail_cond, low, input_01)
plot(trail_stop,
title =
"Trail Stop Line",
color = close > trail_stop ? color.rgb(0, 255, 8) : color.rgb(255, 0, 0))