
Chiến lược này được sử dụng để giao dịch đường ngắn trong ngày bằng cách tính toán các đường trung bình di chuyển chỉ số vào ngày 9 và ngày 15 để xác định các tín hiệu mua và bán hình thành từ EMA Gold Forks và Dead Forks. Một tín hiệu mua được tạo ra khi 9EMA đi 15EMA và một đường K gần nhất là đường dương; một tín hiệu bán được tạo ra khi 9EMA đi 15EMA dưới 9EMA và một đường K gần nhất là đường âm.
Chiến lược này có những ưu điểm sau:
Chiến lược này cũng có một số rủi ro:
Phản ứng:
Chiến lược này có thể được tối ưu hóa theo các khía cạnh sau:
Chiến lược này kết hợp hai chỉ số EMA để xác định hướng xu hướng và tín hiệu lọc thực thể K-line, sử dụng ATR dừng động, là một chiến lược giao dịch trong ngày đơn giản và thực tế. Bằng cách tối ưu hóa tham số và kết hợp nhiều yếu tố, bạn có thể nâng cao hơn nữa sự ổn định và lợi nhuận của chiến lược.
/*backtest
start: 2023-01-17 00:00:00
end: 2024-01-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA Scalping Strategy", shorttitle="EMAScalp", overlay=true)
// Input parameters
ema9_length = input(9, title="9 EMA Length")
ema15_length = input(15, title="15 EMA Length")
// Calculate EMAs
ema9 = ta.ema(close, ema9_length)
ema15 = ta.ema(close, ema15_length)
// Plot EMAs on the chart
plot(ema9, color=color.blue, title="9 EMA")
plot(ema15, color=color.red, title="15 EMA")
// Identify Bullish and Bearish candles
bullish_candle = close > open
bearish_candle = close < open
// Bullish conditions for Buy Signal
buy_condition = ta.crossover(close, ema9) and ema15 < ema9 and bullish_candle
// Bearish conditions for Sell Signal
sell_condition = ta.crossunder(close, ema9) and ema15 > ema9 and bearish_candle
// Plot Buy and Sell signals
plotshape(series=buy_condition, title="Buy Signal", color=color.green, style=shape.triangleup, location=location.belowbar)
plotshape(series=sell_condition, title="Sell Signal", color=color.red, style=shape.triangledown, location=location.abovebar)
// Optional: Add stop-loss levels
atr_length = input(14, title="ATR Length for Stop Loss")
atr_multiplier = input(1.5, title="ATR Multiplier for Stop Loss")
atr_value = ta.atr(atr_length)
stop_loss_level = strategy.position_size > 0 ? close - atr_multiplier * atr_value : close + atr_multiplier * atr_value
plot(stop_loss_level, color=color.gray, title="Stop Loss Level", linewidth=2)
// Strategy rules
if (buy_condition)
strategy.entry("Buy", strategy.long)
strategy.exit("Exit Buy", from_entry="Buy", loss=stop_loss_level)
if (sell_condition)
strategy.entry("Sell", strategy.short)
strategy.exit("Exit Sell", from_entry="Sell", loss=stop_loss_level)