Strategy Eur/Usd mini, how to reduce the maximum % drawdown?
Forums › ProRealTime English forum › ProOrder support › Strategy Eur/Usd mini, how to reduce the maximum % drawdown?
- This topic has 54 replies, 7 voices, and was last updated 4 years ago by Gregg.
-
-
12/19/2018 at 1:28 AM #87409
I made an MTF version out of latest Vonasi’s version, by:
- replacing empty line 5 with timeframe(Daily,UpdateOnClose)
- replacing empty line 48 with timeframe(default)
- appending Nicolas’ Trailing Stoip code
- launching it form a 2-minute TF
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788//Eur/Usd mini - 1D Capital Eur 500,00DEFPARAM CUMULATEORDERS = falseDEFPARAM PRELOADBARS = 10000timeframe(Daily,UpdateOnClose) //Dailya = 2 //2t = 2 //2m = 1.8 //1.8n=1Atr = AverageTrueRange[14](close) //14Atrs = 0.1 //0.1x = average[A,3]((High+Low+close)/3) //3b1e = ((t*x)-high)+(ATR*ATRs)s1e = ((t*x)-Low)-(ATR*ATRs)Hbop = (t*x)-(t*Low)+HighLbop = (t*x)-(t*High)+Low// Condizioni per entrare su posizioni longIF NOT LongOnMarket AND close <= lbop THENBUY n CONTRACTS AT market//b1e limit//SELL AT s1e limitENDIF// Condizioni per uscire da posizioni longIf LongOnMarket and close > s1e THENSELL AT market//s1e limitif close > positionprice then//positionprice thensell at marketendifENDIF// Condizioni per entrare su posizioni shortIF NOT ShortOnMarket AND close >= hbop THENSELLSHORT n CONTRACTS AT market//s1e limit//EXITSHORT AT b1e limitENDIF// Condizioni per uscire da posizioni shortIF ShortOnMarket and close < b1e THENEXITSHORT AT market//b1e limitif close < positionprice thenexitshort at marketendifENDIFset stop loss (m*ATR)//timeframe(default) //2 min//************************************************************************//trailing stop functiontrailingstart = 45 //45 trailing will start @trailinstart points profittrailingstep = 15 //15 trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIFas from attached screenshot.
12/19/2018 at 8:46 AM #87415**** Google translator*******
Thank you all for your contribution.
In theory, the strategy should appeal to all markets with appropriate optimization, in fact I would like to create a diversified portfolio on this strategy.
Roberto hrazie for your MTF code but are looking for a strategy that can betray in real and I think the MTF is not yet supported in real mode, or something has changed? Currently I use PRT of IG which has some limitation.12/19/2018 at 8:57 AM #87417You are correct that MTF is still only in beta testing but we should all be using this opportunity to live forward test MTF strategies so that we are ready and confident in them when it finally gets put live. Also it helps PRT/IG find any bugs which can only benefit us too.
Regarding your topic title and trying to reduce draw down. I personally think the draw down is already pretty low on your strategy and it will be difficult to improve on it without adding new conditions which will then just lead to less trades and less profit and increased chance of curve fitting. I usually have in my mind that every time that I add a condition that has a variable then I am multiplying the curve fitting probability by two. My theory is that if we keep it simple and it works then it is more likely to work going forward than a complicated strategy is.
1 user thanked author for this post.
12/19/2018 at 9:03 AM #8741812/19/2018 at 11:04 AM #87424Drawdown can be further reduced by applying the same strategy above to Heikin-Ashi candlesticks (still Nicolas’ trailing stop code uses regular japanese candlesticks).
I tested it on regular EurUsd, rather than the mini one because I found out it is not just a simple math issue (it’s, or it should be, just a division by ten), because on the mini contract I’ve been reported more than 300 trades, almost all losing money. While there’s no difference when applied to DAX €25 and DAX €5, it’s the same behaviour, only multiplied/divided by 5!
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105//Eur/Usd mini - 1D Capital Eur 500,00DEFPARAM CUMULATEORDERS = falseDEFPARAM PRELOADBARS = 0timeframe(Daily,UpdateOnClose) //Daily// HA definitionif BarIndex > 1 thenxClose = (open+close+low+high)/4xOpen = (xOpen[1]+xClose[1])/2haHigh = Max(xOpen, xClose)haLow = Min(xOpen, xClose)xHigh = Max(High,haHigh)xLow = Min(Low,haLow)elsexClose = (open+close+low+high)/4xOpen = (Open[1]+Close[1])/2haHigh = Max(xOpen, xClose)haLow = Min(xOpen, xClose)xHigh = Max(High,haHigh)xLow = Min(Low,haLow)endifa = 2 //2t = 2 //2m = 1.8 //1.8n=1Atr = AverageTrueRange[14](xClose) //14Atrs = 0.1 //0.1x = average[A,0]((xHigh+xLow+xclose)/3) //4b1e = ((t*x)-xhigh)+(ATR*ATRs)s1e = ((t*x)-xLow)-(ATR*ATRs)Hbop = (t*x)-(t*xLow)+xHighLbop = (t*x)-(t*xHigh)+xLow// Condizioni per entrare su posizioni longIF NOT LongOnMarket AND xclose <= lbop THENBUY n CONTRACTS AT market//b1e limit//SELL AT s1e limitENDIF// Condizioni per uscire da posizioni longIf LongOnMarket and xclose > s1e THENSELL AT market//s1e limitif xclose > positionprice then//positionprice thensell at marketendifENDIF// Condizioni per entrare su posizioni shortIF NOT ShortOnMarket AND xclose >= hbop THENSELLSHORT n CONTRACTS AT market//s1e limit//EXITSHORT AT b1e limitENDIF// Condizioni per uscire da posizioni shortIF ShortOnMarket and xclose < b1e THENEXITSHORT AT market//b1e limitif xclose < positionprice thenexitshort at marketendifENDIFset stop loss (m*ATR)//timeframe(default) //2 min//************************************************************************//trailing stop functiontrailingstart = 35 //35 trailing will start @trailinstart points profittrailingstep = 15 //15 trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF1 user thanked author for this post.
12/19/2018 at 3:54 PM #8746512/19/2018 at 4:14 PM #8747312/19/2018 at 4:21 PM #8747612/19/2018 at 7:03 PM #87479Hello Vonasi and Roberto I still ask you a kindness, you could test the attached code since 1995. Thank you
BOP Reinv + Martingala1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586//@Coscar Break Out Point on Eur/Usd mini - 1D Capital Ini Eur 500,00DEFPARAM CUMULATEORDERS= falseDEFPARAM PRELOADBARS = 10000//***********************************************************************************************************CapitalIni = 10000 // Capitale iniziale cifra interaNrContratti = 1 // numero di contratti inizialiMargineBroker = 378 // Margine richiesto dal broker per 1 contratto Eur/Usd MiniMartingala = 1 // "1" per ON , "0" per OFF del sistema MartinagalaMulti = 1 //Martingala Moltiplicatore in caso di vincita - "1" per OFFReinvestimento = 1 // "1" per ON , "0" per OFF reinvestimento Capiatale e profittoPerc = 20 // Percentuale del capiatale destinato al reinvestimento (consiglio max 30%)Protec = 100 // "0" per OFF, Contratti massimi consentiti al sistema -Ricordarsi di inserire questo valore in fase di Trading Automatico in PRTAvg = 2 // Moving Average Period Two DayAtrs = 0.16 // Multiplier coefficient Atrm = 1.8 // Multiplier coefficient Stop Loss//***********************************************************************************************ONCE OrderSize = NrContrattiONCE ExitIndex = -2Capital= CapitalIni + strategyprofitIF Reinvestimento = 1 THENNR = ((Capital * Perc/100)/MargineBroker)*1000n = (ROUND(NR)/1000)Elsen = 1endifIF Protec>0 and n>Protec THENn=ProtecendifAtr = AverageTrueRange[14](close)x = average[Avg,3]((High+Low+close)/3)b1e = ((2*x)-high)+(ATR*ATRs)s1e = ((2*x)-Low)-(ATR*ATRs)Hbop = (2*x)-(2*Low)+HighLbop = (2*x)-(2*High)+Low// Condizioni per entrare su posizioni longIF NOT LongOnMarket AND close<lbop THENBUY OrderSize CONTRACTS AT b1e limitSELL AT s1e limitENDIF// Condizioni per uscire da posizioni longIf LongOnMarket THENSELL AT s1e limitif close > positionprice thensell at marketendifExitIndex = BarIndexENDIF// Condizioni per entrare su posizioni shortIF NOT ShortOnMarket AND close>hbop THENSELLSHORT OrderSize CONTRACTS AT s1e limitEXITSHORT AT b1e limitENDIF// Condizioni per uscire da posizioni shortIF ShortOnMarket THENEXITSHORT AT b1e limitif close < positionprice thenexitshort at marketendifExitIndex = BarIndexENDIFset stop loss (m*ATR)//Martingala************************IF Barindex = ExitIndex + 1 THENExitIndex = 0IF PositionPerf(1) < 0 THENOrderSize = OrderSize + (Martingala*0)ELSIF PositionPerf(1) > 0 THENOrderSize = 1 * n * MultiENDIFENDIFIF Capital<-500 thenQuitENDIFGRAPH OrderSize12/19/2018 at 7:50 PM #8748312/19/2018 at 8:05 PM #8748512/19/2018 at 8:57 PM #87487I have not had a chance to test your code yet but the only way to truly test robustness is to live forward test a strategy in demo. Personally I would not put any real money on any strategy until I have seen months of forward testing in a variety of market conditions and preferably lots and lots of trades. It is boring and you need a lot of patience but losing money is easy enough so why be in such a hurry to do it?
I see that you have added some form of martingale and money management. Don’t do this until you have forward tested the strategy with level stakes – it just makes you imagine all the money you could be making when in reality you don’t even know if level stakes would make you any. Martingale is very dangerous unless you have a very high win rate strategy or one where the wins are much bigger than the losses and even then it can all suddenly get very expensive in just a few losing trades. If you have Warren Buffets bank balance behind you then use martingale – if not then don’t.
All just my humble opinion but then people have all sorts of opinions on how to best lose money at this game!
07/07/2019 at 5:02 PM #102093I did a multitimeframe version of this fine system that seems to perform quite well in backtest, I haven´t tried it yet in real or demo
07/07/2019 at 7:02 PM #102096Next autumn v11 is likely to be made available to IG customers, thus making 1M bars available for backtesting.
07/07/2019 at 11:38 PM #102107Here is the code from the version posted by TempusFugit. My main concern if I had coded it myself would be the exit conditions based on days of week and time and bars since trades opened which seem to smell horribly of data mining.
The true test is to remove most of them and see how it fairs. With just the exit if it is 2100 hours and the rest of them are removed then the equity curve is a little less inspiring. Image attached.
If we let them back in one by one then the equity curve starts to look nice again which is really telling us that they are just data mining conditions. IMHO.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566// COSCAR Eur/Usd mini - 1H En PRTCode//Version Tempus FugitDEFPARAM CUMULATEORDERS= falseDEFPARAM PRELOADBARS = 10000//VARIABLESPositionSize = 1ENTRYHOURS = HOUR=1nwma = 2 //Periodos de la Media de Willians sobre "la mediana"t = 2//Multiplicador de la media y otros valoresNATR = 14//Periodos del ATRm = 1.8//2.7 //Multiplicador del ATR para el stopAtrs = 0.16//Multiplicador del ATR para el precio límite de salidaTimeframe(Daily,Updateonclose)Atr = AverageTrueRange[NATR](close)x = average[nwma,3]((High+Low+close)/3)b1e = ((t*x)-high)+(ATR*ATRs)s1e = ((t*x)-Low)-(ATR*ATRs)Hbop = (t*x)-(t*Low)+HighLbop = (t*x)-(t*High)+LowLONGSIGNAL = CLOSE<LBOPSHORTSIGNAL = CLOSE>HBOPTimeframe(Default)LONGENTRY = LONGSIGNALLONGENTRY = LONGENTRY AND ENTRYHOURSLONGENTRY = LONGENTRY AND DAYOFWEEK<4//SIN JUEVES Y VIERNESSHORTENTRY = SHORTSIGNALSHORTENTRY = SHORTENTRY AND ENTRYHOURSSHORTENTRY = SHORTENTRY AND DAYOFWEEK<4//SIN JUEVES Y VIERNESIF LONGENTRY THENBUY PositionSize CONTRACTS AT B1E LIMITSELL AT s1e limitELSIF SHORTENTRY THENSELLSHORT PositionSize CONTRACTS AT S1E LIMITEXITSHORT AT b1e limitENDIFIf LongOnMarket THENSELL AT s1e limitELSIF ShortOnMarket THENEXITSHORT AT b1e limitendifWINEXIT = ONMARKETWINEXIT = WINEXIT AND POSITIONPERF>0WINEXIT = WINEXIT AND (HOUR=21 OR (BARINDEX-TRADEINDEX>70))LOSSEXIT = ONMARKETLOSSEXIT = LOSSEXIT AND POSITIONPERF<0LOSSEXIT = LOSSEXIT AND BARINDEX-TRADEINDEX>80LOSSEXIT = LOSSEXIT AND HOUR>=21LOSSEXIT = LOSSEXIT AND (DAYOFWEEK=3 OR DAYOFWEEK=5)IF WINEXIT OR LOSSEXIT THENSELL AT MARKETEXITSHORT AT MARKETENDIFset stop loss (m*ATR) -
AuthorPosts