OPEN-SOURCE SCRIPT

BANGNURI

Theo zrtreder
//version=5
indicator("Multi-Timeframe Bullish/Bearish Strategy with Timeframe Filters", overlay=true)

// Input untuk memilih timeframe yang digunakan
useW1 = input(true, title="Use Weekly (W1)")
useD1 = input(true, title="Use Daily (D1)")
useH12 = input(true, title="Use 12-Hourly (H12)")
useH8 = input(true, title="Use 8-Hourly (H8)")
useH4 = input(true, title="Use 4-Hourly (H4)")
useH3 = input(true, title="Use 3-Hourly (H3)")
useH2 = input(true, title="Use 2-Hourly (H2)")
useH1 = input(true, title="Use Hourly (H1)")
useM30 = input(true, title="Use 30-Minute (M30)")

// Fungsi untuk mengecek bullish dan bearish candle
isBullish(timeframe) =>
openPrice = request.security(syminfo.tickerid, timeframe, open)
closePrice = request.security(syminfo.tickerid, timeframe, close)
closePrice > openPrice

isBearish(timeframe) =>
openPrice = request.security(syminfo.tickerid, timeframe, open)
closePrice = request.security(syminfo.tickerid, timeframe, close)
closePrice < openPrice

// Mengecek kondisi bullish dan bearish di berbagai timeframe berdasarkan input pengguna
bullishW1 = useW1 ? isBullish("W") : true
bullishD1 = useD1 ? isBullish("D") : true
bullishH12 = useH12 ? isBullish("720") : true
bullishH8 = useH8 ? isBullish("480") : true
bullishH4 = useH4 ? isBullish("240") : true
bullishH3 = useH3 ? isBullish("180") : true
bullishH2 = useH2 ? isBullish("120") : true
bullishH1 = useH1 ? isBullish("60") : true
bullishM30 = useM30 ? isBullish("30") : true

bearishW1 = useW1 ? isBearish("W") : true
bearishD1 = useD1 ? isBearish("D") : true
bearishH12 = useH12 ? isBearish("720") : true
bearishH8 = useH8 ? isBearish("480") : true
bearishH4 = useH4 ? isBearish("240") : true
bearishH3 = useH3 ? isBearish("180") : true
bearishH2 = useH2 ? isBearish("120") : true
bearishH1 = useH1 ? isBearish("60") : true
bearishM30 = useM30 ? isBearish("30") : true

// Sinyal Buy dan Sell berdasarkan timeframe yang dipilih
buySignal = bullishW1 and bullishD1 and bullishH12 and bullishH8 and bullishH4 and bullishH3 and bullishH2 and bullishH1 and bullishM30
sellSignal = bearishW1 and bearishD1 and bearishH12 and bearishH8 and bearishH4 and bearishH3 and bearishH2 and bearishH1 and bearishM30

// Menambahkan tanda pada grafik
bgcolor(buySignal ? color.new(color.green, 90) : na, title="Buy Signal Background")
bgcolor(sellSignal ? color.new(color.red, 90) : na, title="Sell Signal Background")

// Menampilkan sinyal pada grafik
plotshape(buySignal, style=shape.labelup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal", text="BUY")
plotshape(sellSignal, style=shape.labeldown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal", text="SELL")
multitimeframe

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm