
Chiến lược này là một chiến lược giao dịch tùy chọn theo dõi xu hướng dựa trên một loạt các chỉ số kỹ thuật. Chiến lược này sử dụng giao dịch EMA như một tín hiệu trung tâm, kết hợp với SMA, VWAP để xác nhận hướng xu hướng và lọc tín hiệu bằng MACD và RSI như một chỉ số phụ. Chiến lược này sử dụng quản lý rủi ro điểm dừng cố định để tăng tỷ lệ thành công của giao dịch thông qua điều kiện nhập cảnh và quản lý vị trí nghiêm ngặt.
Chiến lược sử dụng chéo của 8 chu kỳ và 21 chu kỳ EMA như tín hiệu giao dịch chính, kích hoạt nhiều tín hiệu khi ngắn hạn EMA vượt qua dài hạn EMA và đáp ứng các điều kiện sau: Giá nằm trên 100 và 200 chu kỳ SMA, MACD đường trên đường tín hiệu, RSI lớn hơn 50. Các điều kiện kích hoạt của tín hiệu tháo là ngược lại. Chiến lược giới thiệu VWAP làm tham chiếu trọng lượng giá để giúp xác định vị trí tương đối của giá hiện tại.
Đây là một chiến lược giao dịch tùy chọn theo dõi xu hướng đa chỉ số có cấu trúc, logic rõ ràng. Chiến lược này giúp tăng độ tin cậy của tín hiệu giao dịch bằng cách phối hợp với nhiều chỉ số kỹ thuật và sử dụng điểm dừng cố định để quản lý rủi ro. Mặc dù có một số rủi ro vốn có trong chiến lược, nhưng hướng tối ưu hóa được đưa ra có thể nâng cao hơn nữa sự ổn định và khả năng sinh lợi của chiến lược. Thiết kế hình ảnh của chiến lược cũng giúp các nhà giao dịch hiểu và thực hiện tín hiệu giao dịch trực quan.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("OptionsMillionaire Strategy with Take Profit Only", overlay=true, default_qty_type=strategy.fixed, default_qty_value=1)
// Define custom magenta color
magenta = color.rgb(255, 0, 255) // RGB for magenta
// Input settings for Moving Averages
ema8 = ta.ema(close, 8)
ema21 = ta.ema(close, 21)
sma100 = ta.sma(close, 100)
sma200 = ta.sma(close, 200)
vwap = ta.vwap(close) // Fixed VWAP calculation
// Input settings for MACD and RSI
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
rsi = ta.rsi(close, 14)
// Define trend direction
isBullish = ema8 > ema21 and close > sma100 and close > sma200
isBearish = ema8 < ema21 and close < sma100 and close < sma200
// Buy (Call) Signal
callSignal = ta.crossover(ema8, ema21) and isBullish and macdLine > signalLine and rsi > 50
// Sell (Put) Signal
putSignal = ta.crossunder(ema8, ema21) and isBearish and macdLine < signalLine and rsi < 50
// Define Position Size and Take-Profit Level
positionSize = 1 // Position size set to 1 (each trade will use one contract)
takeProfitPercent = 5 // Take profit is 5%
// Variables to track entry price and whether the position is opened
var float entryPrice = na // To store the entry price
var bool positionOpen = false // To check if a position is open
// Backtesting Execution
if callSignal and not positionOpen
// Enter long position (call)
strategy.entry("Call", strategy.long, qty=positionSize)
entryPrice := close // Store the entry price
positionOpen := true // Set position as opened
if putSignal and not positionOpen
// Enter short position (put)
strategy.entry("Put", strategy.short, qty=positionSize)
entryPrice := close // Store the entry price
positionOpen := true // Set position as opened
// Only check for take profit after position is open
if positionOpen
// Calculate take-profit level (5% above entry price for long, 5% below for short)
takeProfitLevel = entryPrice * (1 + takeProfitPercent / 100)
// Exit conditions (only take profit)
if strategy.position_size > 0
// Long position (call)
if close >= takeProfitLevel
strategy.exit("Take Profit", "Call", limit=takeProfitLevel)
if strategy.position_size < 0
// Short position (put)
if close <= takeProfitLevel
strategy.exit("Take Profit", "Put", limit=takeProfitLevel)
// Reset position when it is closed (this happens when an exit is triggered)
if strategy.position_size == 0
positionOpen := false // Reset positionOpen flag
// Plot EMAs
plot(ema8, color=magenta, linewidth=2, title="8 EMA")
plot(ema21, color=color.green, linewidth=2, title="21 EMA")
// Plot SMAs
plot(sma100, color=color.orange, linewidth=1, title="100 SMA")
plot(sma200, color=color.blue, linewidth=1, title="200 SMA")
// Plot VWAP
plot(vwap, color=color.white, style=plot.style_circles, title="VWAP")
// Highlight buy and sell zones
bgcolor(callSignal ? color.new(color.green, 90) : na, title="Call Signal Background")
bgcolor(putSignal ? color.new(color.red, 90) : na, title="Put Signal Background")
// Add buy and sell markers (buy below, sell above)
plotshape(series=callSignal, style=shape.labelup, location=location.belowbar, color=color.green, text="Buy", title="Call Signal Marker")
plotshape(series=putSignal, style=shape.labeldown, location=location.abovebar, color=color.red, text="Sell", title="Put Signal Marker")