
Bei dieser Strategie handelt es sich um ein quantitatives Handelssystem, das auf gleitendem Durchschnitt, RSI-Indikator und Trailing-Stop-Loss basiert. Es kombiniert Trendverfolgung und Momentumindikatoren in der technischen Analyse, um durch die Festlegung strenger Ein- und Ausstiegsbedingungen risikokontrollierte Transaktionen zu erreichen. Die Kernlogik der Strategie besteht darin, nach überverkauften Gelegenheiten für den Markteinstieg bei einem Aufwärtstrend zu suchen und Trailing-Stop-Losses zu verwenden, um Gewinne zu schützen.
Die Strategie verwendet den 200-Tage-SMA (Simple Moving Average) als Grundlage zur Trendbeurteilung und kombiniert ihn mit dem Relative Strength Index (RSI), um Handelssignale zu generieren. Speziell:
Dies ist eine quantitative Handelsstrategie mit einer vollständigen Struktur und klarer Logik. Es kombiniert mehrere technische Indikatoren, um stabile Renditen bei gleichzeitiger Kontrolle der Risiken zu erzielen. Obwohl es Raum für Optimierung gibt, ist das grundlegende Framework gut praktikabel und skalierbar. Die Strategie eignet sich für mittel- und langfristige Anleger und verfügt über eine gute Anpassungsfähigkeit an unterschiedliche Marktumgebungen.
/*backtest
start: 2025-01-09 00:00:00
end: 2025-01-16 00:00:00
period: 15m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=5
strategy("200 SMA Crossover Strategy", overlay=false)
// Define inputs
smaLength = input.int(200, title="SMA Length")
rsiLength = input.int(14, title="RSI Length")
rsiThreshold = input.float(40, title="RSI Threshold")
trailStopPercent = input.float(5.0, title="Trailing Stop Loss (%)")
waitingPeriod = input.int(10, title="Waiting Period (Days)")
// Calculate 200 SMA
sma200 = ta.sma(close, smaLength)
// Calculate RSI
rsi = ta.rsi(close, rsiLength)
// Plot the 200 SMA and RSI
plot(sma200, color=color.blue, linewidth=2, title="200 SMA")
plot(rsi, color=color.purple, title="RSI", display=display.none)
// Define buy and sell conditions
var isLong = false
var float lastExitTime = na
var float trailStopPrice = na
// Explicitly declare timeSinceExit as float
float timeSinceExit = na(lastExitTime) ? na : (time - lastExitTime) / (24 * 60 * 60 * 1000)
canEnter = na(lastExitTime) or timeSinceExit > waitingPeriod
buyCondition = close > sma200 and rsi < rsiThreshold and canEnter
if (buyCondition and not isLong)
strategy.entry("Buy", strategy.long)
trailStopPrice := na
isLong := true
// Update trailing stop loss if long
if (isLong)
trailStopPrice := na(trailStopPrice) ? close * (1 - trailStopPercent / 100) : math.max(trailStopPrice, close * (1 - trailStopPercent / 100))
// Check for trailing stop loss or sell condition
if (isLong and (close < trailStopPrice or close < sma200))
strategy.close("Buy")
lastExitTime := time
isLong := false
// Plot buy and sell signals
plotshape(series=buyCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=(isLong and close < trailStopPrice) or close < sma200, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")