
Die Strategie ist ein Trend-Tracking-Trading-System, das die Formen der SMA, der Bollinger Bands und der K-Linien kombiniert. Die Strategie wird hauptsächlich durch die Identifizierung von Schluckformen als Handelssignale und die Kombination der 200-Tages-Mittellinie und der Bollinger Bands als Trendbestätigung eingesetzt, um das Risiko zu kontrollieren.
Die Kernlogik der Strategie ist die Bestätigung von Handelssignalen durch die Kombination von mehreren technischen Indikatoren.
Das System eröffnet mehrere Positionen, wenn der Preis über der 200-Tage-Mittellinie und der Brin-Band-Mittelbahn eine bullish-absorptive Form aufweist. Entsprechend eröffnet das System leere Positionen, wenn der Preis unter der 200-Tage-Mittellinie und der Brin-Band-Mittelbahn eine bearish-absorptive Form aufweist.
Es ist eine strukturierte, logisch klare Trend-Tracking-Strategie. Durch die Kombination von Gleichgewichts-, Brin- und Swallow-Formen wird sowohl die Zuverlässigkeit der Handelssignale gewährleistet als auch eine eindeutige Methode zur Risikokontrolle bereitgestellt. Obwohl es eine gewisse Verzögerung gibt, ist es insgesamt ein robustes und risikokontrollierbares Handelssystem.
/*backtest
start: 2025-01-08 00:00:00
end: 2025-02-07 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ardhankurniawan
//@version=5
//@version=5
strategy("Engulfing Candles Strategy with Risk-Reward 1:2 by ardhankurniawan", overlay = true)
// Menyimpan harga pembukaan dan penutupan dari candle sebelumnya dan saat ini
openBarPrevious = open[1]
closeBarPrevious = close[1]
openBarCurrent = open
closeBarCurrent = close
// Menghitung SMA 200
sma200 = ta.sma(close, 200)
// Menghitung Bollinger Bands (BB) dengan periode 14 dan standar deviasi 2
length = 14
src = close
mult = 2.0
basis = ta.sma(src, length) // Mid Bollinger Band (SMA)
dev = mult * ta.stdev(src, length) // Standard deviation
upperBB = basis + dev
lowerBB = basis - dev
midBB = basis // Mid Bollinger Band adalah SMA
// Kondisi Bullish Engulfing: harga pembukaan saat ini lebih rendah dari harga penutupan sebelumnya,
// harga pembukaan saat ini lebih rendah dari harga pembukaan sebelumnya, dan harga penutupan saat ini lebih tinggi dari harga pembukaan sebelumnya.
bullishEngulfing = (openBarCurrent <= closeBarPrevious) and (openBarCurrent < openBarPrevious) and (closeBarCurrent > openBarPrevious)
// Kondisi Bearish Engulfing: harga pembukaan saat ini lebih tinggi dari harga penutupan sebelumnya,
// harga pembukaan saat ini lebih tinggi dari harga pembukaan sebelumnya, dan harga penutupan saat ini lebih rendah dari harga pembukaan sebelumnya.
bearishEngulfing = (openBarCurrent >= closeBarPrevious) and (openBarCurrent > openBarPrevious) and (closeBarCurrent < openBarPrevious)
// Kondisi untuk membeli (buy) hanya jika Bullish Engulfing terjadi di atas SMA 200 dan Mid Bollinger Band
buyCondition = bullishEngulfing and close > sma200 and close > midBB
// Kondisi untuk menjual (sell) hanya jika Bearish Engulfing terjadi di bawah SMA 200 dan Mid Bollinger Band
sellCondition = bearishEngulfing and close < sma200 and close < midBB
// Menghitung Stop Loss dan Take Profit dengan Risk-Reward Ratio 1:2
longSL = low // SL di low candle bullish engulfing (prev low)
longRR = (close - low) * 2 // TP dengan Risk-Reward 1:2
longTP = close + longRR // TP untuk posisi long
shortSL = high // SL di high candle bearish engulfing (prev high)
shortRR = (high - close) * 2 // TP dengan Risk-Reward 1:2
shortTP = close - shortRR // TP untuk posisi short
// Strategi Buy ketika kondisi beli terpenuhi dengan SL dan TP
if buyCondition
strategy.entry("Buy", strategy.long) // Perintah beli ketika Bullish Engulfing terjadi di atas SMA 200 dan Mid Bollinger Band
strategy.exit("Sell Exit", from_entry = "Buy", stop = longSL, limit = longTP) // SL dan TP untuk posisi long
// Strategi Sell ketika kondisi jual terpenuhi dengan SL dan TP
if sellCondition
strategy.entry("Sell", strategy.short) // Perintah jual ketika Bearish Engulfing terjadi di bawah SMA 200 dan Mid Bollinger Band
strategy.exit("Buy Exit", from_entry = "Sell", stop = shortSL, limit = shortTP) // SL dan TP untuk posisi short
// Menambahkan kondisi untuk keluar dari posisi
if sellCondition
strategy.close("Buy") // Menutup posisi beli jika Bearish Engulfing terjadi di bawah SMA 200 dan Mid Bollinger Band
if buyCondition
strategy.close("Sell") // Menutup posisi jual jika Bullish Engulfing terjadi di atas SMA 200 dan Mid Bollinger Band
// Plotting SMA 200 dan Bollinger Bands
plot(sma200, color = color.blue, linewidth = 2, title = "SMA 200")
plot(upperBB, color = color.green, linewidth = 1, title = "Upper BB")
plot(lowerBB, color = color.red, linewidth = 1, title = "Lower BB")
plot(midBB, color = color.orange, linewidth = 2, title = "Mid BB")
// Alert condition
alertcondition(buyCondition, title = "Bullish Engulfing Above SMA 200 and Mid BB", message = "[CurrencyPair] [TimeFrame], Bullish Engulfing above SMA 200 and Mid Bollinger Band")
alertcondition(sellCondition, title = "Bearish Engulfing Below SMA 200 and Mid BB", message = "[CurrencyPair] [TimeFrame], Bearish Engulfing below SMA 200 and Mid Bollinger Band")