-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathVSVTrend.pine
More file actions
28 lines (22 loc) · 1.05 KB
/
VSVTrend.pine
File metadata and controls
28 lines (22 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//@version=5
strategy("VSVTrend Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === INPUTS ===
show_strategy = input.bool(true, title="Strategy ON/OFF")
use_supertrend = input.bool(true, title="Supertrend filter")
atrPeriod = input.int(10, title="ATR period")
factor = input.float(3.0, title="factor")
// === SUPER TREND ===
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
plot(use_supertrend ? supertrend : na, color=direction ? color.green : color.red, title="Supertrend")
// === УСЛОВИЯ ЗА ВХОД/ИЗХОД ===
longCond = show_strategy and (direction == 1)
shortCond = show_strategy and (direction == -1)
if (longCond)
strategy.entry("Long", strategy.long)
if (shortCond)
strategy.entry("Short", strategy.short)
// === TP/SL ===
sl = input.float(1.5, title="Стоп Лос (%)") / 100
tp = input.float(3.0, title="Тейк Профит (%)") / 100
strategy.exit("TP/SL Long", from_entry="Long", profit=tp, loss=sl)
strategy.exit("TP/SL Short", from_entry="Short", profit=tp, loss=sl)