
Die Strategie verwendet drei verschiedene Perioden des Index Moving Averages (EMA) und des Relative Strength Index (RSI) zur Beurteilung von Markttrends und Handelssignalen. Sie erzeugt ein Kaufsignal, wenn der Preis die 200-Tage-EMA überschreitet und der RSI größer als 50 ist, und ein Verkaufsignal, wenn der Preis die 200-Tage-EMA überschreitet und der RSI kleiner als 50 ist.
Die Strategie kann durch Handelssignale zwischen EMA-Mehrkopf-Aufstellung und RSI-Strength-Bereich relativ klare mittlere und langfristige Trendbewegungen zu erfassen. Aber in der Regel in der Anfangsphase der Trendwende und in der Schaukel-Markt, insgesamt geeignet für trendigen Markt. Die Folge kann weiter optimiert werden, um die Strategie Stabilität und Ertrags-Risiko-Verhältnis von Signal, Position, Stop-Loss-Stop, Filter-Bedingungen, etc. zu verbessern.
/*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)