
Die Mean Return Dynamic Strategy ist eine Trend-Trading-Strategie, die kurzfristige Preisdurchschnitte verfolgt. Sie kombiniert die Mean Return-Indikatoren mit den Dynamic Indicators, um die mittelfristigen Trends des Marktes zu beurteilen.
Die Strategie berechnet zuerst die Mean Return Line und die Standard Differenz des Preises. Dann wird in Kombination mit den Upper Threshold und Lower Threshold Parametern eine gute Threshold-Einstellung verwendet, um zu berechnen, ob der Preis über die Mean Return Line hinausgeht.
Für mehrköpfige Signale, die einen Standarddifferenz unter dem Preis der Mittelwert-Rückkehrlinie benötigen, ist der Schlusskurs niedriger als der SMA-Mittelwert für den LENGTH-Zyklus und höher als der TREND-SMA-Mittelwert, um diese drei Bedingungen zu erfüllen. Die Ausgangsposition ist der SMA-Mittelwert für den LENGTH-Zyklus.
Für das Leerlaufsignal ist ein Preis höher als die Mittelwert-Rückkehrlinie mit einer Standarddifferenz erforderlich, der Schlusskurs ist höher als der SMA-Mittelwert für den LENGTH-Zyklus und niedriger als der TREND-SMA-Mittelwert, um eine Position in der Leerlaufrichtung zu eröffnen, wenn diese drei Bedingungen erfüllt sind. Die Ausgleichsbedingung ist der SMA-Mittelwert, der den Preis unter dem LENGTH-Zyklus durchläuft.
Die Strategie kombiniert das Percent Profit Target mit dem Percent Stop Loss, um Stop Loss Management zu ermöglichen.
Die Exit-Methode kann entweder eine Durchbrechung des gleitenden Durchschnitts oder eine Durchbrechung der linearen Regression sein.
Durch die Kombination von Multi-Band-Doppelhandel, Trendfilter und Stop-Loss ist es möglich, die mittelfristigen Markttrends zu beurteilen und zu verfolgen.
Der Mean Value Regression Indicator ist eine effektive Methode, um zu bestimmen, ob der Preis von der Wertmitte abweicht.
Der Dynamik-SMA filtert die kurzfristigen Markträusch
Mehrsprachige bilaterale Transaktionen, um Trendchancen in allen Bereichen zu nutzen
Stopp-Loss-Mechanismen können Risiken wirksam kontrollieren
Optionale Exit-Methoden, die sich flexibel an die Marktbedingungen anpassen
Eine vollständige Trend-Trading-Strategie, um mittelfristige Trends besser zu erfassen
Der Mittelwert-Regression-Indikator ist empfindlich auf Parameter-Einstellungen, falsche Thresholds können zu falschen Signalen führen
Zu häufige Schadensersatzfälle bei schweren Erschütterungen
Die Häufigkeit der Transaktionen kann zu hoch sein, was die Transaktionsgebühren und das Risiko eines Ausrutschens erhöht.
Die Slip-Point-Kontrolle ist bei geringer Liquidität der Handelsvarianten möglicherweise nicht optimal.
Mehrflächige bilaterale Transaktionen sind riskant und erfordern eine vorsichtige Geldverwaltung.
Diese Risiken können durch Parameteroptimierung, Anpassung der Stop-Loss-Methode und Finanzmanagement kontrolliert werden.
Optimierte Parameter für die Mean-Return- und Dynamometer-Einstellungen, um sie besser an die Eigenschaften der verschiedenen Sorten anzupassen
Erhöhung der Indikatoren für die Beurteilung von Trends und Verbesserung der Fähigkeit, Trends zu erkennen
Optimierung von Stop-Loss-Strategien, um sie besser auf starke Marktschwankungen einzusetzen
Erweiterung des Moduls zur Positionsverwaltung und Anpassung der Positionsgröße an die Marktbedingungen
Hinzufügen weiterer Windmodule, wie maximale Rückzugskontrolle, Nettowertkurvenkontrolle usw.
Berücksichtigen Sie die automatische Optimierung der Strategieparameter mit einer Methode des maschinellen Lernens
Zusammenfassend lässt sich sagen, dass die Mean Value Regression Dynamics Strategie die mittelfristigen Wertrücktrendtrends durch eine einfache und effektive Indikatorentwicklung erfasst. Die Strategie hat eine starke Anpassungsfähigkeit und Allgemeingültigkeit, aber auch gewisse Risiken. Durch kontinuierliche Optimierung und Kombination mit anderen Strategien kann eine bessere Performance erzielt werden.
/*backtest
start: 2023-10-15 00:00:00
end: 2023-11-14 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © GlobalMarketSignals
//@version=4
strategy("GMS: Mean Reversion Strategy", overlay=true)
LongShort = input(title="Long Only or Short Only or Both?", type=input.string, defval="Both", options=["Both", "Long Only", "Short Only"])
Lookback = input(title="Length", type=input.integer, defval=10, minval=0)
LThr1 = input(title="Upper threshold", type=input.float, defval=1, minval=0)
LThr = input(title="Lower threshold", type=input.float, defval=-1, maxval=0)
src = input(title="Source", type=input.source, defval=close)
LongShort2 = input(title="Linear Regression Exit or Moving Average Exit?", type=input.string, defval="MA", options=["LR", "MA"])
SMAlenL = input(title="MA/LR Exit Length", type = input.integer ,defval=10)
SMALen2 = input(title="Trend SMA Length", type = input.integer ,defval=200)
AboveBelow = input(title="Above or Below Trend SMA?", type=input.string, defval="Above", options=["Above", "Below", "Don't Include"])
PTbutton = input(title="Profit Target On/Off", type=input.bool, defval=true)
ProfitTarget = input(title="Profit Target %", type=input.float, defval=1, step=0.1, minval=0)
SLbutton = input(title="Stop Loss On/Off", type=input.bool, defval=true)
StopLoss = input(title="Stop Loss %", type=input.float, defval=-1, step=0.1, maxval=0)
x = (src-linreg(src,Lookback,0))/(stdev(src,Lookback))
plot(linreg(src,Lookback,0))
//PROFIT TARGET & STOPLOSS
if PTbutton == true and SLbutton == true
strategy.exit("EXIT", profit=((close*(ProfitTarget*0.01))/syminfo.mintick), loss=((close*(StopLoss*-0.01))/syminfo.mintick))
else
if PTbutton == true and SLbutton == false
strategy.exit("PT EXIT", profit=((close*(ProfitTarget*0.01))/syminfo.mintick))
else
if PTbutton == false and SLbutton == true
strategy.exit("SL EXIT", loss=((close*(StopLoss*-0.01))/syminfo.mintick))
else
strategy.cancel("PT EXIT")
////////////////////////
//MOVING AVERAGE EXIT//
//////////////////////
if LongShort=="Long Only" and AboveBelow=="Above" and LongShort2 =="MA"
strategy.entry("LONG", true, when = x<LThr and close<sma(close,SMAlenL) and close>sma(close,SMALen2))
strategy.close("LONG", when = close>sma(close,SMAlenL))
if LongShort=="Long Only" and AboveBelow=="Below" and LongShort2 =="MA"
strategy.entry("LONG", true, when = x<LThr and close<sma(close,SMAlenL) and close<sma(close,SMALen2))
strategy.close("LONG", when = close>sma(close,SMAlenL))
if LongShort=="Long Only" and AboveBelow=="Don't Include" and LongShort2 =="MA"
strategy.entry("LONG", true, when = x<LThr and close<sma(close,SMAlenL) )
strategy.close("LONG", when = close>sma(close,SMAlenL))
///////
if LongShort=="Short Only" and AboveBelow=="Above" and LongShort2 =="MA"
strategy.entry("SHORT", false, when = x>LThr1 and close>sma(close,SMAlenL) and close>sma(close,SMALen2))
strategy.close("SHORT", when = close<sma(close,SMAlenL))
if LongShort=="Short Only" and AboveBelow=="Below" and LongShort2 =="MA"
strategy.entry("SHORT", false, when = x>LThr1 and close>sma(close,SMAlenL) and close<sma(close,SMALen2))
strategy.close("SHORT", when = close<sma(close,SMAlenL))
if LongShort=="Short Only" and AboveBelow=="Don't Include" and LongShort2 =="MA"
strategy.entry("SHORT", false, when = x>LThr1 and close>sma(close,SMAlenL) )
strategy.close("SHORT", when = close<sma(close,SMAlenL))
//////
if LongShort=="Both" and AboveBelow=="Above" and LongShort2 =="MA"
strategy.entry("LONG", true, when = x<LThr and close<sma(close,SMAlenL) and close>sma(close,SMALen2))
strategy.close("LONG", when = close>sma(close,SMAlenL))
if LongShort=="Both" and AboveBelow=="Below" and LongShort2 =="MA"
strategy.entry("LONG", true, when = x<LThr and close<sma(close,SMAlenL) and close<sma(close,SMALen2))
strategy.close("LONG", when = close>sma(close,SMAlenL))
if LongShort=="Both" and AboveBelow=="Don't Include" and LongShort2 =="MA"
strategy.entry("LONG", true, when = x<LThr and close<sma(close,SMAlenL) )
strategy.close("LONG", when = close>sma(close,SMAlenL))
///////
if LongShort=="Both" and AboveBelow=="Above" and LongShort2 =="MA"
strategy.entry("SHORT", false, when = x>LThr1 and close>sma(close,SMAlenL) and close>sma(close,SMALen2))
strategy.close("SHORT", when = close<sma(close,SMAlenL))
if LongShort=="Both" and AboveBelow=="Below" and LongShort2 =="MA"
strategy.entry("SHORT", false, when = x>LThr1 and close>sma(close,SMAlenL) and close<sma(close,SMALen2))
strategy.close("SHORT", when = close<sma(close,SMAlenL))
if LongShort=="Both" and AboveBelow=="Don't Include" and LongShort2 =="MA"
strategy.entry("SHORT", false, when = x>LThr1 and close>sma(close,SMAlenL) )
strategy.close("SHORT", when = close<sma(close,SMAlenL))
/////////////////
//LIN REG EXIT//
///////////////
if LongShort=="Long Only" and AboveBelow=="Above" and LongShort2 =="LR"
strategy.entry("LONG", true, when = x<LThr and close<linreg(close,SMAlenL,0) and close>sma(close,SMALen2))
strategy.close("LONG", when = close>linreg(close,SMAlenL,0))
if LongShort=="Long Only" and AboveBelow=="Below" and LongShort2 =="LR"
strategy.entry("LONG", true, when = x<LThr and close<linreg(close,SMAlenL,0) and close<sma(close,SMALen2))
strategy.close("LONG", when = close>linreg(close,SMAlenL,0))
if LongShort=="Long Only" and AboveBelow=="Don't Include" and LongShort2 =="LR"
strategy.entry("LONG", true, when = x<LThr and close<linreg(close,SMAlenL,0) )
strategy.close("LONG", when = close>linreg(close,SMAlenL,0))
///////
if LongShort=="Short Only" and AboveBelow=="Above" and LongShort2 =="LR"
strategy.entry("SHORT", false, when = x>LThr1 and close>linreg(close,SMAlenL,0) and close>sma(close,SMALen2))
strategy.close("SHORT", when = close<linreg(close,SMAlenL,0))
if LongShort=="Short Only" and AboveBelow=="Below" and LongShort2 =="LR"
strategy.entry("SHORT", false, when = x>LThr1 and close>linreg(close,SMAlenL,0) and close<sma(close,SMALen2))
strategy.close("SHORT", when = close<linreg(close,SMAlenL,0))
if LongShort=="Short Only" and AboveBelow=="Don't Include" and LongShort2 =="LR"
strategy.entry("SHORT", false, when = x>LThr1 and close>linreg(close,SMAlenL,0) )
strategy.close("SHORT", when = close<linreg(close,SMAlenL,0))
//////
if LongShort=="Both" and AboveBelow=="Above" and LongShort2 =="LR"
strategy.entry("LONG", true, when = x<LThr and close<linreg(close,SMAlenL,0) and close>sma(close,SMALen2))
strategy.close("LONG", when = close>linreg(close,SMAlenL,0))
if LongShort=="Both" and AboveBelow=="Below" and LongShort2 =="LR"
strategy.entry("LONG", true, when = x<LThr and close<linreg(close,SMAlenL,0) and close<sma(close,SMALen2))
strategy.close("LONG", when = close>linreg(close,SMAlenL,0))
if LongShort=="Both" and AboveBelow=="Don't Include" and LongShort2 =="LR"
strategy.entry("LONG", true, when = x<LThr and close<linreg(close,SMAlenL,0) )
strategy.close("LONG", when = close>linreg(close,SMAlenL,0))
///////
if LongShort=="Both" and AboveBelow=="Above" and LongShort2 =="LR"
strategy.entry("SHORT", false, when = x>LThr1 and close>linreg(close,SMAlenL,0) and close>sma(close,SMALen2))
strategy.close("SHORT", when = close<linreg(close,SMAlenL,0))
if LongShort=="Both" and AboveBelow=="Below" and LongShort2 =="LR"
strategy.entry("SHORT", false, when = x>LThr1 and close>linreg(close,SMAlenL,0) and close<sma(close,SMALen2))
strategy.close("SHORT", when = close<linreg(close,SMAlenL,0))
if LongShort=="Both" and AboveBelow=="Don't Include" and LongShort2 =="LR"
strategy.entry("SHORT", false, when = x>LThr1 and close>linreg(close,SMAlenL,0) )
strategy.close("SHORT", when = close<linreg(close,SMAlenL,0))