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.
-
-
07/30/2020 at 2:11 PM #140469
Does anyone know of any reason why one shouldn’t trade with this enabled?
Maybe the reason is, that the profit/equity curve for a longer period is not better than without cumulation. Other reason could be a higher DD,but I can´check it, because my longest period in 5m TF is only 15 month.
07/30/2020 at 4:18 PM #140496Does anyone know of any reason why one shouldn’t trade with this enabled?
Would be scary if one morning you woke up and the System had accumulated 20 trades (position size is 20) and you were close to or on a margin call??
08/02/2020 at 9:30 AM #140641Thank you VinzentVega and GraHal for your feedback. Whilst the extensive parameters required to generate a signal mean that there don’t appear to be many triggered, the point of waking up to 20 positions on at once remains a reality.
I found this post by Vonasi which I shall incorporate into the latest version to negate the risk and set a max position allowed;
https://www.prorealcode.com/topic/using-true-cumulating-positions/#post-97661
Thanks again everyone, much appreciated.
08/04/2020 at 6:15 PM #140889I’m recently new to this thread and have read over all the content and quite impressed on what has been put together in this strategy. I ran a few versions (as below) on my IG demo account and am pleased with the results so far, 6 wins and 2 losses. The two losses were also quite minimal especially in comparison to the gains made on the winning trades. I wanted to ask you all of which charts each of these should be getting loaded into. Have I loaded these to the correct charts?
DAX MoD V2.2a Loaded On 5 Min Germany 30 Cash (5 EURO) i.e. not the futures.
DOW MoD V4.7 Loaded On 5 Min DJI Wall Street Cash ($10) DOW Main
DJ MoD V4.7a Loaded On 5 Min DJI Wall Street Cash ($10) DOW Main
I noticed there is also a NAS Version of NAS MoD V3. Is this to be loaded onto the USTech 100 ($1) NASDAQ Futures?
08/10/2020 at 6:32 PM #14133308/11/2020 at 8:39 AM #14136208/24/2020 at 8:46 AM #14239808/24/2020 at 8:55 AM #142401I have been testing these MoD algos with a few colleagues, with some other commercial algorithms we had headaches regarding time zone settings needing to be set in a particular country/time zone or they would not work. The procedure when loading could not use the individual exchange time zones but we needed to change the time zone for PRT completely whilst loading the algorithm.
When using the DAX V2.2a, DJI V4.7a and NAS V3 algorithms, which time zone settings are required?
@nonetheless @dowjones Am tagging you guys as you had posted the versions of the strategy that I am using.08/24/2020 at 9:31 AM #142411DAX V2.2a, DJI V4.7a and NAS V3 algorithms, which time zone settings are required?
DAX V2.2a = UTC + 2
DJI V4.7.2a = UTC + 8
I didn’t use NAS, so I’m not sure…
1 user thanked author for this post.
09/30/2020 at 5:33 PM #145991Hi all,
Iv’e tried to use the Mother of Dragons for setting up a system for Brent. Im wondering if anyone else have a system running that isn’t stopped on a regular basis?
The error message is:
“The trading system was stopped due to a division by zero during the evaluation of the last candlestick. You can add protections to your code to prevent divisions by zero then backtest the system to check the correction.”Found a old post about this regarding one or two value RSI and ghost bars but can’t seem to figure out what would cause it since the RSI is above
After a lot of trial and error im not 100% who to credit for the code and there for the header misses correct credits. Sorry for that but a lot of thanks for the work everybody put in to this and thanks for sharing!
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364// Definition of code parametersDEFPARAM CumulateOrders = false // Cumulating positions deactivatedDEFPARAM preloadbars = 10000//Money ManagementMM = 0 // = 0 for optimizationif MM = 0 thenpositionsize = 1ENDIF//code re-investCapital = 1000 // initial capitalEquity = Capital + StrategyProfitif MM = 1 thenpositionsize = Max(1, Equity * (1/Capital))positionsize = Round(positionsize*100)positionsize = positionsize/100// change from "1" to "position" in buy/sell conditions to use re-invest//********************ENDIF//code quit strategymaxequity = max(equity,maxequity)DrawdownNeededToQuit = 20 // percent drawdown from max equity to stop strategyif equity < maxequity * (1 - (DrawdownNeededToQuit/100)) thenquitendif// Time managementCtime = not (time >= 205959 or time < 070000)// Friday 22:00 Close ALL operations.IF DayOfWeek = 5 AND time = 220000 THENSELL AT MARKETEXITSHORT AT MARKETENDIF// Settings//Timeframe 2h//Period weightedaverageQ1 = 44 // 1-600//Supertrendq2 = 6 // 1 - 10q3 = 6 // 1- 10// MA averageq4 = 7 // 1- 100q5 = 4 // 0-6// RSIq6 = 20q7 = 10q8 = 6q9 = 2// 30 min// Averageq10 = 2 // 1- 10q11 = 5 // 1- 10// 15 min// Averageq12 = 3 // 1- 10q13 = 4 // 1- 10// Periodcq14 = 42// 10 min// supertrendq15 = 2 //naq16 = 7 // na// 5 min//RSIq17 = 8q18 = 3q19 = 12q20 = 11//ma averageq21 = 17q22 = 5//Periodbq23 = 17//Long SLq24 = 7//Long TPq25 = 9//Short SLq26 = 7//Short TPq27 = 9TIMEFRAME(2 hours,updateonclose)Period= Q1inner = 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[q2,q3]c3 = (close > indicator1)c4 = (close < indicator1)ma = average[q4,q5](close)c11 = ma > ma[1]c12 = ma < ma[1]//Stochastic RSI | indicatorlengthRSI = q6 //RSI periodlengthStoch = q7 //Stochastic periodsmoothK = q8 //Smooth signal of stochastic RSIsmoothD = q9 //Smooth signal of smoothed stochastic RSImyRSI = RSI[lengthRSI](close)MinRSI = lowest[lengthStoch](myrsi)MaxRSI = highest[lengthStoch](myrsi)StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)K = average[smoothK](stochrsi)*100D = average[smoothD](K)c13 = K>Dc14 = K<DTIMEFRAME(30 minutes,updateonclose)indicator5 = Average[q10](typicalPrice)indicator6 = Average[q11](typicalPrice)c15 = (indicator5 > indicator6)c16 = (indicator5 < indicator6)TIMEFRAME(15 minutes,updateonclose)indicator2 = Average[q12](typicalPrice)indicator3 = Average[q13](typicalPrice)c7 = (indicator2 > indicator3)c8 = (indicator2 < indicator3)Periodc= q14innerc = 2*weightedaverage[round( Periodc/2)](typicalprice)-weightedaverage[Periodc](typicalprice)HULLc = weightedaverage[round(sqrt(Periodc))](innerc)c9 = HULLc > HULLc[1]c10 = HULLc < HULLc[1]TIMEFRAME(10 minutes)indicator1a = SuperTrend[q15,q16]c19 = (close > indicator1a)c20 = (close < indicator1a)TIMEFRAME(5 minutes)//Stochastic RSI | indicatorlengthRSIa = q17 //RSI periodlengthStocha = q18 //Stochastic periodsmoothKa = q19 //Smooth signal of stochastic RSIsmoothDa = q20 //Smooth signal of smoothed stochastic RSImyRSIa = RSI[lengthRSIa](close)MinRSIa = lowest[lengthStocha](myrsia)MaxRSIa = highest[lengthStocha](myrsia)StochRSIa = (myRSIa-MinRSIa) / (MaxRSIa-MinRSIa)Ka = average[smoothKa](stochrsia)*100Da = average[smoothDa](Ka)c23 = Ka>Dac24 = Ka<Dama3 = average[q21,q22](close)c21 = ma3 > ma3[1]c22 = ma3 < ma3[1]Periodb= q23innerb = 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]//Long target and stoplossLSL = Q24 /10LTP = Q25 /10// Conditions to enter long positionsIF Ctime and dhigh(0)-high<250 and c1 AND C3 AND C5 and c7 and c9 and c11 and c13 and c15 and c19 and c21 and c23 THENBUY positionsize CONTRACT AT MARKETSET STOP %LOSS LSLSET TARGET %PROFIT LTPENDIF//Short target and stoplossSSL = Q26/10STP = Q27/10// Conditions to enter short positionsIF Ctime and low-dlow(0)<700 and c2 AND C4 AND C6 and c8 and c10 and c12 and c14 and c16 and c20 and c22 and c24 THENSELLSHORT positionsize CONTRACT AT MARKETSET STOP %LOSS SSLSET TARGET %PROFIT STPENDIF//================== exit in profitif longonmarket and C6 and c8 and close>positionprice thensell at marketendifIf shortonmarket and C5 and c7 and close<positionprice thenexitshort at marketendif//==============exit at lossif longonmarket AND c2 and c6 and close<positionprice thensell at marketendifIf shortonmarket and c1 and c5 and close>positionprice thenexitshort at marketendif//%trailing stop functiontrailingPercent = .26stepPercent = .014if onmarket thentrailingstart = tradeprice(1)*(trailingpercent/100) //trailing will start @trailingstart points profittrailingstep = tradeprice(1)*(stepPercent/100) //% step to move the stoplossendif//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart THENnewSL = tradeprice(1)+trailingstepENDIF//next movesIF newSL>0 AND close-newSL>trailingstep THENnewSL = newSL+trailingstepENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart THENnewSL = tradeprice(1)-trailingstepENDIF//next movesIF newSL>0 AND newSL-close>trailingstep THENnewSL = newSL-trailingstepENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF//************************************************************************IF longonmarket and barindex-tradeindex>1800 and close<positionprice thensell at marketendifIF shortonmarket and barindex-tradeindex>610 and close>positionprice thenexitshort at marketendif//=============================================if longonmarket and abs(open-close)<1 and high[1]>high and close>positionprice and high-close>10thensell at marketendifif shortonmarket and abs(open-close)<1 and low[1]>low and close-low>13 and close<positionprice thenexitshort at marketendif//===================================myrsiM5=rsi[14](close)//if myrsiM5<30 and barindex-tradeindex>1 and longonmarket and close>positionprice thensell at marketendifif myrsiM5>70 and barindex-tradeindex>1 and shortonmarket and close<positionprice thenexitshort at marketendif// --------- US DAY LIGHT SAVINGS MONTHS ---------------- //mar = month = 3 // MONTH STARTnov = month = 11 // MONTH ENDIF (month > 3 AND month < 11) OR (mar AND day>14) OR (mar AND day-dayofweek>7) OR (nov AND day<=dayofweek AND day<7) THENUSDLS=010000ELSEUSDLS=0ENDIFonce openStrongLong = 0once openStrongShort = 0if (time <= 223000 - USDLS and time >= 050000 - USDLS) thenopenStrongLong = 0openStrongShort = 0endif//detect strong direction for market openonce rangeOK = 40once tradeMin = 1500IF (time >= 223500 - USDLS) AND (time <= 223500 + tradeMin - USDLS) AND ABS(close - open) > rangeOK THENIF close > open and close > open[1] THENopenStrongLong = 1openStrongShort = 0ENDIFIF close < open and close < open[1] THENopenStrongLong = 0openStrongShort = 1ENDIFENDIFonce bollperiod = 20once bollMAType = 1once s = 2bollMA = average[bollperiod, bollMAType](close)STDDEV = STD[bollperiod]bollUP = bollMA + s * STDDEVbollDOWN = bollMA - s * STDDEVIF bollUP = bollDOWN THENbollPercent = 50ELSEbollPercent = 100 * (close - bollDOWN) / (bollUP - bollDOWN)ENDIFonce trendPeriod = 70once trendPeriodResume = 30once trendGap = 3once trendResumeGap = 6if not onmarket thenfullySupported = 0fullyResisteded = 0endif//Market supported in the wrong directionIF shortonmarket AND fullySupported = 0 AND summation[trendPeriod](bollPercent > 50) >= trendPeriod - trendGap THENfullySupported = 1ENDIF//Market pull back but continue to be supportedIF shortonmarket AND fullySupported = 1 AND bollPercent[trendPeriodResume + 1] < 0 AND summation[trendPeriodResume](bollPercent > 50) >= trendPeriodResume - trendResumeGap THENexitshort at marketENDIF//Market resisted in wrong directionIF longonmarket AND fullyResisteded = 0 AND summation[trendPeriod](bollPercent < 50) >= trendPeriod - trendGap THENfullyResisteded = 1ENDIF//Market pull back but continue to be resistedIF longonmarket AND fullyResisteded = 1 AND bollPercent[trendPeriodResume + 1] > 100 AND summation[trendPeriodResume](bollPercent < 50) >= trendPeriodResume - trendResumeGap THENsell at marketENDIF////Started real wrong directiononce strongTrend = 60once strongPeriod = 8once strongTrendGap = 2IF shortonmarket and openStrongLong and barindex - tradeindex < 12 and summation[strongPeriod](bollPercent > strongTrend) = strongPeriod - strongTrendGap thenexitshort at marketENDIFIF longonmarket and openStrongShort and barindex - tradeindex < 12 and summation[strongPeriod](bollPercent < 100 - strongTrend) = strongPeriod - strongTrendGap thensell at marketENDIF10/01/2020 at 3:41 PM #146098anyone else have a system running that isn’t stopped on a regular basis
I have run both MoD DAX and DJI for many months, no such issue for me.
For your issue, in my experience, to debug the issue, better to take note when the issue reported, so you can build indicator or GRAPH the suspected division method to check. The problem is Probacktest doesn’t report issue with zero division, I did a dummy test before to purposely divide by zero and backtest still can complete successfully.
10/01/2020 at 3:47 PM #146100I have run both MoD DAX and DJI for many months, no such issue for me.
Yes it works great for with all indexes but can’t get it to run on Brent Crude oil. Tried several setups and always get the zero division error message or the suggestion of preloading bars (can’t remember the error message on top of my head)
10/01/2020 at 3:59 PM #14610210/01/2020 at 4:01 PM #14610510/01/2020 at 4:08 PM #146110Out of curiosity… what are the values you use for you 5M RSI calculations?
This test (have done a few) 8, 3, 12, 11I worked with a strategy on Brent but realized I had to scrap it because of constant zero division error. You can forget about oil for automated trading.
Thanks for confirming that i’m not mad
-
AuthorPosts
Find exclusive trading pro-tools on