
この戦略は,3つの異なる周期の指数移動平均 ((EMA) と相対的に強い指数 ((RSI) を使って市場の傾向と取引信号を判断する.価格が200日EMAを突破し,RSIが50より大きいときに買い信号を生成し,逆に価格が200日EMAを突破し,RSIが50より小さいときに売り信号を生成する.この戦略は日線レベルの波段取引に適用される.
この戦略は,EMAの多頭並びとRSIの強い区間の取引シグナルによって,比較的明確な中長期のトレンド状況を捉えることができます. しかし,トレンドの転換の初期と振動的な市場では,一般的に,全体的にトレンド市場に適しています. その後,シグナル,ポジション,ストップ・ローズ・ストップ,フィルター条件などからさらに最適化して,戦略の安定性と利益リスク比率を向上させることができます.
/*backtest
start: 2024-05-01 00:00:00
end: 2024-05-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Lexi Supreme", overlay=true)
// Calculate EMA 200
ema200 = ta.ema(close, 200)
// Calculate EMA 50
ema50 = ta.ema(close, 50)
// Calculate EMA 21
ema21 = ta.ema(close, 21)
// Calculate RSI
rsiValue = ta.rsi(close, 14)
// Buy condition: RSI above 50 and price crosses above EMA 200
buyCondition = ta.crossover(close, ema200) and rsiValue > 50
// Sell condition: RSI below 50 and price crosses below EMA 200
sellCondition = ta.crossunder(close, ema200) and rsiValue < 50
// Position Size (1% of account balance)
positionSize = 1
// Stop Loss and Take Profit values for buy trades
stopLossBuy = ema200 - 0.00050
takeProfitBuy = 0.00100
// Stop Loss and Take Profit values for sell trades
stopLossSell = ema200 + 0.00050
takeProfitSell = 0.00100
// Plot EMA 200 line in blue
plot(ema200, color=color.blue, title="EMA 200")
// Plot EMA 50 line in red
plot(ema50, color=color.red, title="EMA 50")
// Plot EMA 21 line in green
plot(ema21, color=color.green, title="EMA 21")
// Plot buy entry points in yellow
plotshape(series=buyCondition, title="Buy Signal", color=color.yellow, style=shape.triangleup, location=location.belowbar, size=size.small)
// Plot sell entry points in white
plotshape(series=sellCondition, title="Sell Signal", color=color.white, style=shape.triangledown, location=location.abovebar, size=size.small)
// Strategy entry and exit conditions with position size, stop loss, and take profit for buy trades
if (buyCondition)
strategy.entry("Buy", strategy.long, qty=positionSize)
strategy.exit("Take Profit/Stop Loss Buy", from_entry="Buy", stop=stopLossBuy, limit=close + takeProfitBuy)
// Strategy entry and exit conditions with position size, stop loss, and take profit for sell trades
if (sellCondition)
strategy.entry("Sell", strategy.short, qty=positionSize)
strategy.exit("Take Profit/Stop Loss Sell", from_entry="Sell", stop=stopLossSell, limit=close - takeProfitSell)