
La stratégie est un système de négociation en ligne courte basé sur la théorie de la fraction et la grille adaptative, combinant des seuils de volatilité pour optimiser le moment de la négociation. Le système ajuste dynamiquement le niveau de la grille pour capturer les changements de la microstructure du marché pendant les périodes de forte volatilité, tout en évitant les transactions excessives pendant les périodes de faible volatilité. La stratégie intègre plusieurs indicateurs techniques, y compris l’amplitude réelle moyenne (ATR), la moyenne mobile simple (SMA) et les points de rupture de fraction, pour construire un cadre de décision de négociation complet.
Le cœur de la stratégie est de construire une grille de transactions dynamique en identifiant les fractions et en regroupant les taux de volatilité. La mise en œuvre comprend les étapes clés suivantes:
Il s’agit d’un système de stratégie intégrée combinant la théorie de la fraction, les transactions en grille et le filtrage des taux de volatilité. La capture efficace de la microstructure du marché est réalisée grâce à l’utilisation conjointe de multiples indicateurs techniques. L’avantage de la stratégie réside dans sa capacité d’adaptation et de contrôle des risques, mais il faut également prêter attention à l’optimisation des paramètres et à l’adaptation aux conditions du marché.
/*backtest
start: 2024-02-17 00:00:00
end: 2025-02-15 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("Adaptive Fractal Grid Scalping Strategy", overlay=true)
// Inputs
atrLength = input.int(14, title="ATR Length")
smaLength = input.int(50, title="SMA Length")
gridMultiplierHigh = input.float(2.0, title="Grid Multiplier High")
gridMultiplierLow = input.float(0.5, title="Grid Multiplier Low")
trailStopMultiplier = input.float(0.5, title="Trailing Stop Multiplier")
volatilityThreshold = input.float(1.0, title="Volatility Threshold (ATR)")
// Calculate Fractals
fractalHigh = ta.pivothigh(high, 2, 2)
fractalLow = ta.pivotlow(low, 2, 2)
// Calculate ATR and SMA
atrValue = ta.atr(atrLength)
smaValue = ta.sma(close, smaLength)
// Determine Trend Direction
isBullish = close > smaValue
isBearish = close < smaValue
// Calculate Grid Levels
gridLevelHigh = fractalHigh + atrValue * gridMultiplierHigh
gridLevelLow = fractalLow - atrValue * gridMultiplierLow
// Plot Fractals and Grid Levels
plotshape(not na(fractalHigh), style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
plotshape(not na(fractalLow), style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plot(gridLevelHigh, color=color.red, linewidth=1, title="Grid Level High")
plot(gridLevelLow, color=color.green, linewidth=1, title="Grid Level Low")
// Trade Execution Logic with Volatility Threshold
if (atrValue > volatilityThreshold)
if (isBullish and not na(fractalLow))
strategy.entry("Buy", strategy.long, limit=gridLevelLow)
if (isBearish and not na(fractalHigh))
strategy.entry("Sell", strategy.short, limit=gridLevelHigh)
// Profit-Taking and Stop-Loss
strategy.exit("Take Profit/Stop Loss", "Buy", limit=gridLevelHigh, stop=fractalLow - atrValue * trailStopMultiplier)
strategy.exit("Take Profit/Stop Loss", "Sell", limit=gridLevelLow, stop=fractalHigh + atrValue * trailStopMultiplier)