Spécifications
//@version=5
strategy("Supertrend Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=15)
// Input parameters
atrPeriod = input(10, "ATR Length")
factor = input.float(3.0, "Factor", step=0.01)
trailATR = input.int(1, "ATR Trail", minval=1)
// Calculate Supertrend
[_, trendUp] = ta.supertrend(factor, atrPeriod)
// Entry conditions
longEntry = ta.change(trendUp) < 0
shortEntry = ta.change(trendUp) > 0
// Exit conditions (trail stop with ATR)
longExit = strategy.position_size > 0 and close < nz(strategy.position_avg_price) - trailATR * ta.atr(atrPeriod)
shortExit = strategy.position_size < 0 and close > nz(strategy.position_avg_price) + trailATR * ta.atr(atrPeriod)
// Manage positions
strategy.entry("Long", strategy.long, when=longEntry)
strategy.entry("Short", strategy.short, when=shortEntry)
strategy.close("Long", when=longExit)
strategy.close("Short", when=shortExit)
// Plot equity curve
plot(strategy.equity, title="Equity", color=color.blue, linewidth=2, style=plot.style_line)
Répondu
1
Évaluation
Projets
228
22%
Arbitrage
15
67%
/
20%
En retard
1
0%
Chargé
2
Évaluation
Projets
932
47%
Arbitrage
302
59%
/
25%
En retard
124
13%
Occupé
3
Évaluation
Projets
5
20%
Arbitrage
3
0%
/
33%
En retard
1
20%
Travail
4
Évaluation
Projets
59
34%
Arbitrage
4
25%
/
50%
En retard
6
10%
Chargé
Informations sur le projet
Budget
30+ USD
Pour le développeur
27
USD