
Die Mean Line Regression Breakout Strategie ist eine typische quantitative Handelsstrategie, die Trends verfolgt. Die Strategie nutzt die Moving Averages und ihre Standard-Differenz-Kanäle, um die Marktentwicklung zu beurteilen und ein Handelssignal zu erzeugen, wenn der Preis den Standard-Differenz-Kanal durchbricht.
Die Strategie berechnet zunächst den einfachen Moving Average SMA für N Tage ([default 50 Tage]) und berechnet dann die Standardabweichung StdDev für die Preise dieser Periode basierend auf der SMA. Die SMA ist die mittlere Achse, die StdDev ist das 2fache der StdDev, die nach oben und unten als die ober-und unterhalb der Bahn aufgebaut sind.
Nach dem Eintritt in den Markt setzt die Strategie eine Stop-Loss-Position ein. Konkret ist die Stop-Loss-Linie nach dem Übertritt der Abschlusskurs bei der Eintrittspreis ((100 - Stop-Loss-Prozentsatz); nach dem Leerlauf ist die Stop-Loss-Linie der Abschlusskurs bei der Eintrittspreis ((100 + Stop-Loss-Prozentsatz)).
Diese Strategie hat folgende Vorteile:
Die Strategie birgt auch einige Risiken:
Die Lösungen für die Risiken sind:
Die Strategie kann noch weiter optimiert werden:
Überprüfen Sie die Durchschnittslinie über mehrere Zeiträume, um zu vermeiden, dass die Kurve zu empfindlich ist.
Beurteilung von Trends und Abweichungen in Kombination mit anderen Indikatoren wie MACD.
Einführung von dynamischen Optimierungsparametern für Machine-Learning-Algorithmen.
Die Durchschnittsregerungs-Breakout-Strategie ist insgesamt eine sehr praktische Quantifizierungsstrategie. Sie hat die Vorteile, Trends zu verfolgen und Rücktritte zu kontrollieren, um eine einfache und geeignete Quantifizierungsstrategie zu realisieren. Gleichzeitig muss auf einige Parameterwahl- und Stop-Loss-Einstellungsprobleme geachtet werden, die in Kombination mit Multi-Time-Axis-Analyse und Parameteroptimierung eine bessere Strategieperformance erzielen.
/*backtest
start: 2023-02-16 00:00:00
end: 2024-02-22 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Standard Deviation Bands with Buy/Sell Signals", overlay=true)
// Input for the number of standard deviations
deviationMultiplier = input.float(2.0, title="Standard Deviation Multiplier")
// Input for the length of the moving average
maLength = input.int(50, title="Moving Average Length")
// Input for the stop loss percentage
stopLossPercentage = input.float(12, title="Stop Loss Percentage")
// Calculate the moving average
sma = ta.sma(close, maLength)
// Calculate the standard deviation of the price
priceDeviation = ta.stdev(close, maLength)
// Calculate the upper and lower bands
upperBand = sma + (priceDeviation * deviationMultiplier)
lowerBand = sma - (priceDeviation * deviationMultiplier)
// Plot the bands
plot(upperBand, color=color.green, title="Upper Band")
plot(lowerBand, color=color.red, title="Lower Band")
// Plot the moving average
plot(sma, color=color.blue, title="SMA", linewidth=2)
// Buy Signal
buyCondition = ta.crossover(close, lowerBand)
sellCondition = ta.crossunder(close, upperBand)
// Calculate stop loss level
stopLossLevelBuy = close * (1 - stopLossPercentage / 100)
stopLossLevelSell = close * (1 + stopLossPercentage / 100)
// Create Buy and Sell Alerts
alertcondition(buyCondition, title="Buy Signal", message="Buy Signal - Price Crossed Below Lower Band")
alertcondition(sellCondition, title="Sell Signal", message="Sell Signal - Price Crossed Above Upper Band")
// Plot Buy and Sell Arrows on the chart
plotshape(buyCondition, style=shape.triangleup, location=location.belowbar, color=color.green, title="Buy Signal Arrow")
plotshape(sellCondition, style=shape.triangledown, location=location.abovebar, color=color.red, title="Sell Signal Arrow")
// Exit Long and Short Positions
var float stopLossBuy = na
var float stopLossSell = na
if ta.crossover(close, sma)
stopLossBuy := stopLossLevelBuy
if ta.crossunder(close, sma)
stopLossSell := stopLossLevelSell
strategy.entry("Buy", strategy.long, when = buyCondition)
strategy.exit("Stop Loss/Take Profit Buy", from_entry = "Buy", stop = stopLossBuy)
strategy.entry("Sell", strategy.short, when = sellCondition)
strategy.exit("Stop Loss/Take Profit Sell", from_entry = "Sell", stop = stopLossSell)