Mother of Dragons trading strategy…
Forums › ProRealTime English forum › ProOrder support › Mother of Dragons trading strategy…
- This topic has 522 replies, 50 voices, and was last updated 3 years ago by LaurentBZH35.
-
-
01/23/2020 at 9:18 PM #117641
Ciao Francesco, here’s a second version if you wouldn’t mind backtesting on 200k. MM is disabled but the DrawdownNeededToQuit might still be operative … not sure.
I added another layer of filters at the 15m level. It performs better than v1 over 100k — higher profit from fewer trades — so curious to know if it’s still just fit it to that data set.
Dita incrociate…
01/23/2020 at 10:15 PM #117648nonetheless – could you post the code so that we don’t have to download the ITF file please?
01/23/2020 at 10:35 PM #117649123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153// Definition of code parametersDEFPARAM CumulateOrders = false // Cumulating positions deactivatedDEFPARAM preloadbars = 5000Capital = 10000MinSize = 1 //The minimum position size allowed for the instrument.MM1stType = 0 //Starting type of moneymanagement. Set to 0 for level stakes. Set to 1 for increasing stake size as profits increase and decreasing stake size as profits decrease. Set to 2 for increasing stake size as profits increase with stake size never being decreased.MM2ndType = 0 //Type of money management to switch to after TradesQtyForSwitch number of trades and ProfitNeededForSwitch profit has occurredTradesQtyForSwitch = 15 //Quantity of trades required before switching to second money management choice.ProfitNeededForSwitch = 2 //% profit needed before allowing a money management type change to MM2ndType.DrawdownNeededToSwitch = 8 //% draw down from max equity needed before money management type is changed back to MM1stType.DrawdownNeededToQuit = 25 //% draw down from max equity needed to stop strategyOnce MoneyManagement = MM1stTypeEquity = Capital + StrategyProfitmaxequity = max(equity,maxequity)if equity < maxequity * (1 - (DrawdownNeededToSwitch/100)) thenenoughtrades = 0tradecount = 0moneymanagement = MM1stTypeendifif equity < maxequity * (1 - (DrawdownNeededToQuit/100)) thenquitendifif not EnoughTrades thenif abs(countofposition) > abs(countofposition[1]) thentradecount = tradecount + 1endifif tradecount > TradesQtyForSwitch and maxequity >= Capital * (1 + (ProfitNeededForSwitch/100)) thenEnoughTrades = 1MoneyManagement = MM2ndTypeendifendifIF MoneyManagement = 1 THENPositionSize = Max(MinSize, Equity * (MinSize/Capital))ENDIFIF MoneyManagement = 2 THENPositionSize = Max(LastSize, Equity * (MinSize/Capital))LastSize = PositionSizeENDIFIF MoneyManagement <> 1 and MoneyManagement <> 2 THENPositionSize = MinSizeENDIFPositionSize = Round(PositionSize*100)PositionSize = PositionSize/100// Size of POSITIONSPositionSizeLong = 1 * positionsizePositionSizeShort = 1 * positionsizeTIMEFRAME(120 minutes)Period= 520inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)HULLa = weightedaverage[round(sqrt(Period))](inner)c1 = HULLa > HULLa[1]c2 = HULLa < HULLa[1]indicator1 = SuperTrend[5,21]c3 = (close > indicator1)c4 = (close < indicator1)TIMEFRAME(15 minutes)indicator2 = Average[6](typicalPrice)indicator3 = Average[11](typicalPrice)c7 = (indicator2 > indicator3)c8 = (indicator2 < indicator3)Periodc= 17innerc = 2*weightedaverage[round( Periodc/2)](typicalprice)-weightedaverage[Periodc](typicalprice)HULLc = weightedaverage[round(sqrt(Periodc))](innerc)c9 = HULLc > HULLc[1]c10 = HULLc < HULLc[1]TIMEFRAME(5 minutes)Periodb= 22innerb = 2*weightedaverage[round( Periodb/2)](typicalprice)-weightedaverage[Periodb](typicalprice)HULLb = weightedaverage[round(sqrt(Periodb))](innerb)c5 = HULLb > HULLb[1]and HULLb[1]<HULLb[2]c6 = HULLb < HULLb[1]and HULLb[1]>HULLb[2]// Conditions to enter long positionsIF c1 AND C3 AND C5 and c7 and c9 THENBUY PositionSizeLong CONTRACT AT MARKETSET STOP %LOSS 2.1SET TARGET %PROFIT 1ENDIF// Conditions to enter short positionsIF c2 AND C4 AND C6 and c8 and c10 THENSELLSHORT PositionSizeShort CONTRACT AT MARKETSET STOP %LOSS 1.2SET TARGET %PROFIT 1ENDIF//trailing stop functiontrailingstart = 81 //trailing will start @trailinstart points profittrailingstep = 3 //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 STOPENDIF//************************************************************************1 user thanked author for this post.
01/24/2020 at 10:14 AM #11766101/24/2020 at 10:32 AM #117665Thanks Francesco … sadly not any better than the first one. Only really works for 2019.
May need to rethink this. We all know how it ended for the mother of dragons.
01/24/2020 at 10:36 AM #11766601/24/2020 at 11:16 AM #117671May need to rethink this
Least it wouldn’t have blown the Account in the 1st 100k bars (as many Systems do for OOS periods).
Maybe a Filter to prevent trading when Price is ranging and also in a downtrend.
If you look at the equity curve … in 2017 when price was rising (from Sep 17 to Jan 18) your System made money then lost it when price was in a downtrend (Feb 18 to May 18) then hovered around zero when price was ranging from May 18 until 2019 when it got going again.
It is worth trying a few tweaks and then if Franseco tests again over 200k bars.
But really you need tweak then optimise else you not know if the tweak worked. How about trying it on 100k x 10 min TF as then back to June 2017 should be included??
Just a few thoughts anyway.
01/24/2020 at 1:37 PM #117695TBH, I’m inclined to give it a rest until we get v11. 100k just isn’t enough data to work with unless you’re using +1h TFs.
02/10/2020 at 1:50 PM #11917502/10/2020 at 2:43 PM #119181Hey Fifi, a few tweaks and suddenly it looks so much better – thanks for that!
Your backtest is 200k, yes? How does the curve look for 2017, 2018? The previous version only really came alive in 2019.
02/10/2020 at 3:53 PM #11919002/10/2020 at 6:05 PM #119214That is a much better line, steady increase over almost the whole period. I tried to break it into separate long and short but the result is worse; your version works better as one code going both ways. A couple of big losses in Jan/Feb 2020 but over the long term looks like it could work – génial!
This is another version I had been working on, with a couple of extra filters in the 2h TF to help confirm the primary trend. What do you think? My guess is that yours is probably more stable…
02/10/2020 at 6:08 PM #119217here’s the code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164// Definition of code parametersDEFPARAM CumulateOrders = false // Cumulating positions deactivatedDEFPARAM preloadbars = 5000Capital = 10000MinSize = 1 //The minimum position size allowed for the instrument.MM1stType = 0 //Starting type of moneymanagement. Set to 0 for level stakes. Set to 1 for increasing stake size as profits increase and decreasing stake size as profits decrease. Set to 2 for increasing stake size as profits increase with stake size never being decreased.MM2ndType = 0 //Type of money management to switch to after TradesQtyForSwitch number of trades and ProfitNeededForSwitch profit has occurredTradesQtyForSwitch = 8 //Quantity of trades required before switching to second money management choice.ProfitNeededForSwitch = 2 //% profit needed before allowing a money management type change to MM2ndType.DrawdownNeededToSwitch = 8 //% draw down from max equity needed before money management type is changed back to MM1stType.DrawdownNeededToQuit = 25 //% draw down from max equity needed to stop strategyOnce MoneyManagement = MM1stTypeEquity = Capital + StrategyProfitmaxequity = max(equity,maxequity)if equity < maxequity * (1 - (DrawdownNeededToSwitch/100)) thenenoughtrades = 0tradecount = 0moneymanagement = MM1stTypeendifif equity < maxequity * (1 - (DrawdownNeededToQuit/100)) thenquitendifif not EnoughTrades thenif abs(countofposition) > abs(countofposition[1]) thentradecount = tradecount + 1endifif tradecount > TradesQtyForSwitch and maxequity >= Capital * (1 + (ProfitNeededForSwitch/100)) thenEnoughTrades = 1MoneyManagement = MM2ndTypeendifendifIF MoneyManagement = 1 THENPositionSize = Max(MinSize, Equity * (MinSize/Capital))ENDIFIF MoneyManagement = 2 THENPositionSize = Max(LastSize, Equity * (MinSize/Capital))LastSize = PositionSizeENDIFIF MoneyManagement <> 1 and MoneyManagement <> 2 THENPositionSize = MinSizeENDIFPositionSize = Round(PositionSize*100)PositionSize = PositionSize/100// Size of POSITIONSPositionSizeLong = 1 * positionsizePositionSizeShort = 1 * positionsizeTIMEFRAME(120 minutes)Period= 480inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)HULLa = weightedaverage[round(sqrt(Period))](inner)c1 = HULLa > HULLa[1]c2 = HULLa < HULLa[1]indicator1 = SuperTrend[5,21]c3 = (close > indicator1)c4 = (close < indicator1)indicator4 = CALL "Moving Average Slope"[75,1](close)c11 = (indicator4 > 0)c12 = (indicator4 < 0)Sinewave, ignored, ignored, ignored = CALL "Ehlers Even Better Sinewave"[100,.8, -.8]c13 = (Sinewave > -8)c14 = (Sinewave < .8)TIMEFRAME(15 minutes)indicator2 = Average[6](typicalPrice)indicator3 = Average[11](typicalPrice)c7 = (indicator2 > indicator3)c8 = (indicator2 < indicator3)Periodc= 17innerc = 2*weightedaverage[round( Periodc/2)](typicalprice)-weightedaverage[Periodc](typicalprice)HULLc = weightedaverage[round(sqrt(Periodc))](innerc)c9 = HULLc > HULLc[1]c10 = HULLc < HULLc[1]TIMEFRAME(5 minutes)Periodb= 22innerb = 2*weightedaverage[round( Periodb/2)](typicalprice)-weightedaverage[Periodb](typicalprice)HULLb = weightedaverage[round(sqrt(Periodb))](innerb)c5 = HULLb > HULLb[1]and HULLb[1]<HULLb[2]c6 = HULLb < HULLb[1]and HULLb[1]>HULLb[2]// Conditions to enter long positionsIF c1 AND C3 AND C5 and c7 and c9 and c11 and c13 THENBUY PositionSizeLong CONTRACT AT MARKETSET STOP %LOSS 1.9SET TARGET %PROFIT 1ENDIF// Conditions to enter short positionsIF c2 AND C4 AND C6 and c8 and c10 and c12 and c14 THENSELLSHORT PositionSizeShort CONTRACT AT MARKETSET STOP %LOSS 1.5SET TARGET %PROFIT 1ENDIF//trailing stop functiontrailingstart = 81 //trailing will start @trailinstart points profittrailingstep = 3 //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 STOPENDIF//************************************************************************02/10/2020 at 6:50 PM #119224I tried to break it into separate long and short but the result is worse; your version works better as one code going both ways
For me that would start ringing an alarm bell. If an entry condition and exit condition are good then they should be good whether you have opposite direction trades in the strategy or not.
02/10/2020 at 7:11 PM #119228There wasn’t much in it – less than 10% difference, but better as one code doing both long and short. (I’m talking about Fifi’s version, posted above as v2_MOD – my original worked better as separate long and short).
-
AuthorPosts
Find exclusive trading pro-tools on