
Cette stratégie est un système de trading de retournement de tendance basé sur plusieurs indicateurs techniques, combinant l’indicateur ZigZag, la fractalisation (Fractals) et l’indicateur de retournement parallèle (Parabolic SAR). La stratégie utilise principalement la synergie de ces trois indicateurs pour capturer les opportunités de trading lorsque les tendances du marché évoluent et contrôler les risques grâce à des conditions d’entrée et de sortie strictes.
Le principe central du fonctionnement de la stratégie est la confirmation des signaux de transaction par un mécanisme de triple vérification:
Les conditions d’une transaction multi-vérifiée sont les suivantes:
La stratégie utilise plusieurs indicateurs techniques pour construire un système de négociation de renversement de tendance relativement complet. Les principaux avantages de la stratégie résident dans la fiabilité élevée du signal et le contrôle parfait des risques, mais il faut également être attentif aux risques de faux signaux dans les marchés volatiles. La stabilité et la rentabilité de la stratégie peuvent être encore améliorées par les directions d’optimisation proposées, en particulier l’ajustement des paramètres dynamiques et le filtrage de l’environnement du marché.
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("ZigZag + Fractals + SAR Crossover Stratégiia", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Parametre ZigZag
zigzag_depth = input.int(5, title="ZigZag Hĺbka")
zigzag_deviation = input.float(5.0, title="ZigZag Odchýlka (%)") / 100
// Výpočet ZigZag
var float last_pivot = na
var bool is_uptrend = false // Inicializované na false
zigzag_high = ta.pivothigh(high, zigzag_depth, zigzag_depth)
zigzag_low = ta.pivotlow(low, zigzag_depth, zigzag_depth)
if not na(zigzag_high)
last_pivot := zigzag_high
is_uptrend := false
if not na(zigzag_low)
last_pivot := zigzag_low
is_uptrend := true
// Fraktály
fractal_up = ta.pivothigh(high, 2, 2)
fractal_down = ta.pivotlow(low, 2, 2)
// Parabolic SAR
sar = ta.sar(0.02, 0.2, 0.02)
// Prechody Parabolic SAR a Cena
sar_cross_up = ta.crossover(sar, close) // SAR prechádza nad cenu
sar_cross_down = ta.crossunder(sar, close) // SAR prechádza pod cenu
// Obchodné podmienky založené na prechodoch
long_condition = sar_cross_down and is_uptrend and not na(fractal_down)
short_condition = sar_cross_up and not is_uptrend and not na(fractal_up)
// Vstupy do pozícií
if (long_condition)
strategy.entry("Long", strategy.long)
if (short_condition)
strategy.entry("Short", strategy.short)
// Výstupy z pozícií založené na prechodoch
if (sar_cross_up)
strategy.close("Long")
if (sar_cross_down)
strategy.close("Short")
// Vizualizácia indikátorov
plotshape(series=fractal_up, location=location.abovebar, color=color.red, style=shape.triangledown, title="Fraktál Hore")
plotshape(series=fractal_down, location=location.belowbar, color=color.green, style=shape.triangleup, title="Fraktál Dole")
plot(sar, style=plot.style_cross, color=color.blue, title="Parabolic SAR")
// Vizualizácia ZigZag
plot(is_uptrend ? last_pivot : na, title="ZigZag Low", color=color.green, linewidth=2, style=plot.style_linebr)
plot(not is_uptrend ? last_pivot : na, title="ZigZag High", color=color.red, linewidth=2, style=plot.style_linebr)