
この戦略は,相対的に強い指数 (RSI),移動平均分散指数 (MACD) と平均リアル波幅 (ATR) を併用して,取引信号の信頼性を高めるために,2つの指数の移動平均線 (EMA) の交差を主要な取引信号として使用します. 速いEMAの上を通過して,遅いEMA,およびRSIが70を下回ると,MACD線は,信号の上で,ATR値が前の周期より10%以上上昇すると,多信号を生成します. 逆に,速いEMAの下を通過して,遅いEMA,およびRSIが30以上で,MACD線は,信号の下に,ATR値が前の周期より10%以上上昇すると,空信号を生成します. この戦略は,リスクを管理するために,固定ストップポイントの損失とを設定します.
この戦略は,EMA,RSI,MACD,ATRなどの複数の技術指標を組み合わせて,より信頼性の高い取引信号を生成し,固定ポイントのストップ・ロスを設定することでリスクを制御する.この戦略にはいくつかの欠点があるが,より多くの指標を導入し,ストップ・ロスを最適化し,基本的分析を組み合わせるなど,さらなる最適化と改善によって,この戦略のパフォーマンスを向上させることができる.全体的に,この戦略は,考え方が明確で,理解しやすく,実行しやすく,初心者の学習と使用に適しています.
/*backtest
start: 2024-03-01 00:00:00
end: 2024-03-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Enhanced EMA Crossover Strategy", overlay=true)
// Indicators
ema_fast = ema(close, 8)
ema_slow = ema(close, 14)
rsi = rsi(close, 14)
// Correcting the MACD variable definitions
[macd_line, signal_line, _] = macd(close, 12, 26, 9)
atr_value = atr(14)
// Entry conditions with additional filters
long_condition = crossover(ema_fast, ema_slow) and rsi < 70 and (macd_line > signal_line) and atr_value > atr_value[1] * 1.1
short_condition = crossunder(ema_fast, ema_slow) and rsi > 30 and (macd_line < signal_line) and atr_value > atr_value[1] * 1.1
// Adding debug information
plotshape(series=long_condition, color=color.green, location=location.belowbar, style=shape.xcross, title="Long Signal")
plotshape(series=short_condition, color=color.red, location=location.abovebar, style=shape.xcross, title="Short Signal")
// Risk management based on a fixed number of points
stop_loss_points = 100
take_profit_points = 200
// Order execution
if (long_condition)
strategy.entry("Long", strategy.long, comment="Long Entry")
strategy.exit("Exit Long", "Long", stop=close - stop_loss_points, limit=close + take_profit_points)
if (short_condition)
strategy.entry("Short", strategy.short, comment="Short Entry")
strategy.exit("Exit Short", "Short", stop=close + stop_loss_points, limit=close - take_profit_points)
// Plotting EMAs for reference
plot(ema_fast, color=color.blue, title="Fast EMA")
plot(ema_slow, color=color.orange, title="Slow EMA")