FX:CADJPY   Canadian Dollar / Japanese Yen
//@version=4
strategy("Stratégie des Bandes de Bollinger", overlay=true)

// Paramètres des Bandes de Bollinger
length = input(20, minval=1, title="Longueur")
mult = input(2.0, minval=0.1, title="Multiplicateur")

// Calcul des Bandes de Bollinger
basis = sma(close, length)
dev = mult * stdev(close, length)
upper = basis + dev
lower = basis - dev

// Points d'entrée
longCondition = crossover(close, upper) // Signal d'achat lorsque le prix dépasse la bande de Bollinger supérieure
if (longCondition)
strategy.entry("Achat", strategy.long)

// Points de sortie
stopLoss = input(1.0, title="Stop Loss (%)") // Pourcentage de perte maximal autorisé
takeProfit = input(2.0, title="Take Profit (%)") // Pourcentage de profit minimal attendu

strategy.exit("Vente", "Achat", stop=close*(1-stopLoss/100), limit=close*(1+takeProfit/100))
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.