Hallo,
schon wieder habe ich ein Problem.
Ich benutze im Livehandel dieses System auf DAX H1 mit ziemlich guter Performance.
Nun habe ich versucht ein Grid-System mit Averaging Down einzubauen… ich kriegs einfach nicht hin. Die Performance sinkt rapide… irgendwas mach ich mit meinen beschränkten Fähigkeiten falsch.
Hier das System wie es jetzt läuft. Es handelt in Rücksetzer eines Uptrends hinein.
Könnte mir bitte jemand ein Grid, Abstand frei wählbar, mit einer Average Down Technik einbauen?
// Festlegen der Code-Parameter
DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
DEFPARAM Preloadbars = 300
// Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen vor einer bestimmten Uhrzeit
noEntryBeforeTime = 010000
timeEnterBefore = time >= noEntryBeforeTime
// Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen nach einer bestimmten Uhrzeit
noEntryAfterTime = 233000
timeEnterAfter = time < noEntryAfterTime
// Verhindert das Trading an bestimmten Wochentagen
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Bedingungen zum Einstieg in Long-Positionen
indicator1 = Average[20](close)//20
indicator2 = Average[70](close)//70
c1 = (indicator1 CROSSES UNDER indicator2)
indicator3 = ADX[14]
c2 = (indicator3 > 10)
indicator4 = ADX[14]
c3 = (indicator4 < 30)
IF (c1 AND c2 AND c3) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Bedingungen zum Ausstieg von Long-Positionen
indicator5 = Average[20](close)//20
indicator6 = Average[70](close)//70
c4 = (indicator5 CROSSES OVER indicator6)
IF c4 THEN
SELL AT MARKET
ENDIF
// Stops und Targets
SET STOP pLOSS 150 //150
//************************************************************************
//trailing stop function
trailingstart = 20 //20 trailing will start @trailinstart points profit
trailingstep = 10 //10 trailing step to move the "stoploss"
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
newSL = tradeprice(1)+trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
newSL = newSL+trailingstep*pipsize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
newSL = tradeprice(1)-trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
newSL = newSL-trailingstep*pipsize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
This is the modified code that embed an averaging down system. I removed the stoploss and it is the trailing stop that manage the exit when in profit.
// Festlegen der Code-Parameter
DEFPARAM CumulateOrders = true // Kumulieren von Positionen deaktiviert
DEFPARAM Preloadbars = 300
gridStep = 20
// Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen vor einer bestimmten Uhrzeit
noEntryBeforeTime = 010000
timeEnterBefore = time >= noEntryBeforeTime
// Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen nach einer bestimmten Uhrzeit
noEntryAfterTime = 233000
timeEnterAfter = time < noEntryAfterTime
// Verhindert das Trading an bestimmten Wochentagen
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Bedingungen zum Einstieg in Long-Positionen
indicator1 = Average[20](close)//20
indicator2 = Average[70](close)//70
c1 = (indicator1 CROSSES UNDER indicator2)
indicator3 = ADX[14]
c2 = (indicator3 > 10)
indicator4 = ADX[14]
c3 = (indicator4 < 30)
IF not longonmarket and (c1 AND c2 AND c3) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
BUY 1 CONTRACT AT MARKET
ENDIF
//grid
if longonmarket and tradeprice-close>=gridStep*pointsize then
buy 1 contract at market
endif
// Bedingungen zum Ausstieg von Long-Positionen
indicator5 = Average[20](close)//20
indicator6 = Average[70](close)//70
c4 = (indicator5 CROSSES OVER indicator6)
IF c4 THEN
SELL AT MARKET
ENDIF
// Stops und Targets
//SET STOP pLOSS 150 //150
//************************************************************************
//trailing stop function
trailingstart = 20 //20 trailing will start @trailinstart points profit
trailingstep = 10 //10 trailing step to move the "stoploss"
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-positionprice>=trailingstart*pipsize THEN
newSL = positionprice+trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
newSL = newSL+trailingstep*pipsize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND positionprice-close>=trailingstart*pipsize THEN
newSL = positionprice-trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
newSL = newSL-trailingstep*pipsize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
Of course, like any other martingale, the result could be worse than the benefit. It always risky to not close the losing orders!
Danke, jetzt hab ich meinen Fehler auch erkannt.
Ich hab den Stoploss wieder verändert hinzugefügt und countofposition hinzugefügt. Damit läuft es über 100000bars sehr stabil. Also federt auch kleinere Downtrends ab.
Haben Sie die Möglichkeit über 200000bars zu testen?
Egal in welchem Verlauf Sie die Strategie testen, sie stürzt immer eines Tages ab. Es kommt also darauf an, wann du anfängst … Viel Glück.
Das ist richtig. Das Schicksal des Martingale…
Erstmal vielen Dank.