
The strategy utilizes the ZigZag indicator on a higher time frame (HTF) to plot the ZigZag path on a lower time frame (LTF) chart and generates trading signals based on the opening and closing prices of the HTF candles. The main idea behind the strategy is to use the trend direction of the HTF to guide trading decisions on the LTF while using the ZigZag indicator to identify key support and resistance levels.
The HTF Zigzag Path strategy utilizes the ZigZag indicator on a higher time frame to plot the ZigZag path on a lower time frame chart and generates trading signals based on the opening and closing prices of the HTF candles. The strategy’s strength lies in using the trend direction of the HTF to guide trading decisions on the LTF while leveraging the ZigZag indicator to identify key support and resistance levels. However, the strategy also has some risks, such as potentially missing important price movement information and the possibility of false signals from the ZigZag indicator. To optimize the strategy, considerations can be given to incorporating additional technical indicators, optimizing ZigZag indicator parameters, implementing risk management and position sizing modules, and incorporating fundamental and market sentiment analysis.
/*backtest
start: 2023-04-22 00:00:00
end: 2024-04-27 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("HTF Zigzag Path Strategy", overlay=true, max_boxes_count=500)
// Kullanıcıdan alınan HTF zaman çerçevesi (15 dakika)
htf_timeframe = input.timeframe("15", title="Higher Time Frame")
// Renk ayarlarını belirleme
upColor = input.color(color.white, title="Bullish Candle Color")
downColor = input.color(color.white, title="Bearish Candle Color")
zigzagColor = input.color(color.black, title="Zigzag Line Color")
// HTF verilerini almak
[htfO, htfH, htfL, htfC, htfOpenTime, htfCloseTime] = request.security(syminfo.tickerid, htf_timeframe, [open, high, low, close, time, time_close])
// Geçmiş yüksek ve düşük noktaları saklamak için değişkenler
var float prevHigh = na
var float prevLow = na
// Zigzag çizgilerini saklamak için bir dizi oluşturma
// var line[] zigzag_lines = array.new_line()
// LTF grafikte HTF mum çubuklarını göstermek için kutular oluşturma
// HTF mum çubukları kutuları
// box.new(left=htfOpenTime, top=htfH, right=htfCloseTime, bottom=htfL, border_color=downColor, border_width=1, xloc=xloc.bar_time)
// box.new(left=htfOpenTime, top=htfO, right=htfCloseTime, bottom=htfC, border_color=upColor, border_width=1, xloc=xloc.bar_time)
// Zigzag yolu oluşturmak için yüksek ve düşük noktaları bağlama
if na(prevHigh) or na(prevLow)
prevHigh := htfH
prevLow := htfL
else
// Zigzag çizgilerini çiz
// line.new(x1=bar_index - 1, y1=prevHigh, x2=bar_index, y2=htfH, color=zigzagColor, width=2)
// line.new(x1=bar_index - 1, y1=prevLow, x2=bar_index, y2=htfL, color=zigzagColor, width=2)
// Geçmiş yüksek ve düşük noktaları güncelle
prevHigh := htfH
prevLow := htfL
// Örnek işlem stratejisi
// HTF mum çubuklarının açılış ve kapanış fiyatına göre alım ve satım sinyalleri
longSignal = htfC < htfO // Eğer HTF mum çubuğunun kapanışı açılışından düşükse, alım sinyali ver
shortSignal = htfC > htfO // Eğer HTF mum çubuğunun kapanışı açılışından yüksekse, satım sinyali ver
// Alım işlemi
if longSignal
strategy.entry("Alım", strategy.long)
// Satım işlemi
if shortSignal
strategy.entry("Satım", strategy.short)