
Il s’agit d’une stratégie de négociation basée sur le principe de la rétrogradation de la courbe de Brin, qui permet de réaliser des gains en lots grâce à plusieurs niveaux de stop-loss. La stratégie se négocie lorsque le prix revient après la rupture de la courbe de Brin, et définit 5 niveaux de stop-loss différents pour réduire progressivement la position.
La stratégie est basée sur l’indicateur de la ceinture de Brin sur 20 cycles, en utilisant deux fois la différence standard comme zone de fluctuation. Lorsque le prix se déplace vers le bas et se ferme dans la ceinture, un signal de multiplication est déclenché. Lorsque le prix se déplace vers le haut et se ferme dans la ceinture, un signal de vide est déclenché. Après l’entrée, la stratégie utilise un mécanisme de stop-loss à 5 niveaux, en établissant des points d’arrêt à 0,5%, 1%, 1,5%, 2% et 2,5% respectivement, chaque point d’arrêt éliminant 20% de la position.
La stratégie capte les opportunités de retour à la valeur moyenne via les indicateurs de la ceinture de Brin et gère les risques en utilisant des arrêts à plusieurs niveaux et des arrêts dynamiques. L’avantage de la stratégie réside dans sa gestion de position flexible et son mécanisme de contrôle des risques, mais l’adaptation à l’environnement du marché doit être prise en compte lors de son utilisation.
/*backtest
start: 2025-02-19 10:00:00
end: 2025-02-20 00:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Binance","currency":"BNB_USDT"}]
*/
//@version=5
strategy("Bollinger Band Reentry Strategy", overlay=true)
// Inputs
bbLength = input.int(20, title="Bollinger Band Length")
bbMult = input.float(2.0, title="Bollinger Band Multiplier")
stopLossPerc = input.float(1.0, title="Stop Loss (%)") / 100
tp1Perc = input.float(0.5, title="Take Profit 1 (%)") / 100
tp2Perc = input.float(1.0, title="Take Profit 2 (%)") / 100
tp3Perc = input.float(1.5, title="Take Profit 3 (%)") / 100
tp4Perc = input.float(2.0, title="Take Profit 4 (%)") / 100
tp5Perc = input.float(2.5, title="Take Profit 5 (%)") / 100
allowAddToPosition = input.bool(true, title="Allow Adding to Position")
customSession = input.timeframe("0930-1600", title="Custom Trading Session")
// Calculate Bollinger Bands
basis = ta.sma(close, bbLength)
dev = ta.stdev(close, bbLength)
upperBB = basis + bbMult * dev
lowerBB = basis - bbMult * dev
// Plot Bollinger Bands
plot(upperBB, color=color.red, title="Upper Bollinger Band")
plot(lowerBB, color=color.green, title="Lower Bollinger Band")
plot(basis, color=color.blue, title="Bollinger Band Basis")
// Entry Conditions
longCondition = (ta.crossover(close, lowerBB) or (low < lowerBB and close > lowerBB)) and time(timeframe.period, customSession)
shortCondition = (ta.crossunder(close, upperBB) or (high > upperBB and close < upperBB)) and time(timeframe.period, customSession)
// Execute Trades
if (longCondition)
strategy.entry("Long", strategy.long, when=allowAddToPosition or strategy.position_size == 0)
if (shortCondition)
strategy.entry("Short", strategy.short, when=allowAddToPosition or strategy.position_size == 0)
// Take-Profit and Stop-Loss Levels for Long Trades
if (strategy.position_size > 0)
strategy.exit("TP1", "Long", limit=strategy.position_avg_price * (1 + tp1Perc), qty=strategy.position_size * 0.2) // Take 20% profit
strategy.exit("TP2", "Long", limit=strategy.position_avg_price * (1 + tp2Perc), qty=strategy.position_size * 0.2)
strategy.exit("TP3", "Long", limit=strategy.position_avg_price * (1 + tp3Perc), qty=strategy.position_size * 0.2)
strategy.exit("TP4", "Long", limit=strategy.position_avg_price * (1 + tp4Perc), qty=strategy.position_size * 0.2)
strategy.exit("TP5", "Long", limit=upperBB, qty=strategy.position_size * 0.2) // Take final 20% at opposite band
strategy.exit("Stop Loss", "Long", stop=strategy.position_avg_price * (1 - stopLossPerc))
// Take-Profit and Stop-Loss Levels for Short Trades
if (strategy.position_size < 0)
strategy.exit("TP1", "Short", limit=strategy.position_avg_price * (1 - tp1Perc), qty=strategy.position_size * 0.2)
strategy.exit("TP2", "Short", limit=strategy.position_avg_price * (1 - tp2Perc), qty=strategy.position_size * 0.2)
strategy.exit("TP3", "Short", limit=strategy.position_avg_price * (1 - tp3Perc), qty=strategy.position_size * 0.2)
strategy.exit("TP4", "Short", limit=strategy.position_avg_price * (1 - tp4Perc), qty=strategy.position_size * 0.2)
strategy.exit("TP5", "Short", limit=lowerBB, qty=strategy.position_size * 0.2)
strategy.exit("Stop Loss", "Short", stop=strategy.position_avg_price * (1 + stopLossPerc))
// Alerts
alertcondition(longCondition, title="Long Signal", message="Price closed inside Bollinger Band from below.")
alertcondition(shortCondition, title="Short Signal", message="Price closed inside Bollinger Band from above.")