"Tushar Chandes DMI" conversion code mq5 to prorealtime
Forums › ProRealTime English forum › ProBuilder support › "Tushar Chandes DMI" conversion code mq5 to prorealtime
This topic contains 9 replies, has 2 voices, and was last updated by Rim 1 year, 3 months ago.
Attachments list
 5  DMIofRSX.png
 4  ChandesDMI.png
 3  ChandesDMI_.png
 2  chandes_dmi.mq5
 1  ChandesDMI.png


01/05/2018 at 9:47 PM #5744901/08/2018 at 11:49 AM #5768901/08/2018 at 8:41 PM #5780901/09/2018 at 8:51 AM #5785001/09/2018 at 2:10 PM #58610
I’m sorry but this code have multiple dimensional arrays, which are not possible to be converted into probuilder programming language. Apparently, the RSI used into this indicator is an RSX one, I’ll try to figure out how to reconstruct the indicator without the arrays limitations.
01/12/2018 at 7:33 PM #5926201/15/2018 at 2:27 PM #59547This is what I could made, I took the RSX code I have and use the same period as the ones from the original MT5 indicator. The results are not totally the same, but quite near I suppose ..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162//https://www.prorealcode.com/topic/tusharchandesdmiconversioncodemq5toprorealtime/StdDevPeriod = 5 // Period of Standard DeviationMAStdDevPeriod = 10 // Period of smoothingMAStdDevMode = 0 // Mode of smoothing MADMIPeriod = 15 // Dynamic Momentum Index PeriodDmiLowerLimit = 10 // Dynamic Periods Lower BoundDmiUpperLimit = 50 // Dynamic Periods Upper BoundLevelUp = 70 // Lower levelLevelDown = 30 // Upper levelSD = STD[StdDevPeriod](close)ASD = Average[MAStdDevPeriod,MAStdDevMode](SD)RSIterm = max(1,ROUND(DMIPeriod / (SD/ASD)))RSIterm = Max(Min(RSIterm,DmiUpperLimit),DmiLowerLimit)//RSI calculationplus = summation[RSIterm](closeclose[1]>0)minus = summation[RSIterm](closeclose[1]<0)//pluspow = 1per = RSItermif barindex>per thenbeta = 0.45*(per1)/(0.45*(per1)+2)if pow=1 thenalpha = betaelsif pow=2 thenalpha = beta*betaelsif pow=3 thenalpha = beta*beta*betaelsif pow=4 thenalpha = beta*beta*beta*betaelsif pow=5 thenalpha = beta*beta*beta*beta*betaelsealpha = betaendiftmp0 = (1alpha)*plus + alpha*tmp0[1]tmp1 = (plus  tmp0[0])*(1beta) + beta*tmp1[1]tmp2 = tmp0[0] + tmp1[0]tmp3 = (tmp2[0]  tmp4[1])*((1alpha)*(1alpha)) + (alpha*alpha)*tmp3[1]tmp4 = tmp4[1] + tmp3[0]avgplus = tmp4ftmp0 = (1alpha)*minus + alpha*ftmp0[1]ftmp1 = (minus  ftmp0[0])*(1beta) + beta*ftmp1[1]ftmp2 = ftmp0[0] + ftmp1[0]ftmp3 = (ftmp2[0]  ftmp4[1])*((1alpha)*(1alpha)) + (alpha*alpha)*ftmp3[1]ftmp4 = ftmp4[1] + ftmp3[0]avgminus = ftmp4endifRS = avgplus/avgminusDMIRSX = 100  100 / ( 1 + RS )return DMIRSX as "Dynamic Momentum Index", levelup style(dottedline) as "level up", leveldown style(dottedline) as "level down"01/17/2018 at 10:13 PM #5974901/18/2018 at 9:18 AM #59766All the inputs are there … 9 of them. The names are the same in the code, you can compare.
I just added the “Price to use” in this version:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162//https://www.prorealcode.com/topic/tusharchandesdmiconversioncodemq5toprorealtime/StdDevPeriod = 5 // Period of Standard DeviationMAStdDevPeriod = 8 // Period of smoothingMAStdDevMode = 0 // Mode of smoothing MADMIPeriod = 15 // Dynamic Momentum Index PeriodDmiLowerLimit = 10 // Dynamic Periods Lower BoundDmiUpperLimit = 50 // Dynamic Periods Upper BoundLevelUp = 70 // Lower levelLevelDown = 30 // Upper levelSD = STD[StdDevPeriod](customclose)ASD = Average[MAStdDevPeriod,MAStdDevMode](SD)RSIterm = max(1,ROUND(DMIPeriod / (SD/ASD)))RSIterm = Max(Min(RSIterm,DmiUpperLimit),DmiLowerLimit)//RSI calculationplus = summation[RSIterm](customclosecustomclose[1]>0)minus = summation[RSIterm](customclosecustomclose[1]<0)//pluspow = 1per = RSItermif barindex>per thenbeta = 0.45*(per1)/(0.45*(per1)+2)if pow=1 thenalpha = betaelsif pow=2 thenalpha = beta*betaelsif pow=3 thenalpha = beta*beta*betaelsif pow=4 thenalpha = beta*beta*beta*betaelsif pow=5 thenalpha = beta*beta*beta*beta*betaelsealpha = betaendiftmp0 = (1alpha)*plus + alpha*tmp0[1]tmp1 = (plus  tmp0[0])*(1beta) + beta*tmp1[1]tmp2 = tmp0[0] + tmp1[0]tmp3 = (tmp2[0]  tmp4[1])*((1alpha)*(1alpha)) + (alpha*alpha)*tmp3[1]tmp4 = tmp4[1] + tmp3[0]avgplus = tmp4ftmp0 = (1alpha)*minus + alpha*ftmp0[1]ftmp1 = (minus  ftmp0[0])*(1beta) + beta*ftmp1[1]ftmp2 = ftmp0[0] + ftmp1[0]ftmp3 = (ftmp2[0]  ftmp4[1])*((1alpha)*(1alpha)) + (alpha*alpha)*ftmp3[1]ftmp4 = ftmp4[1] + ftmp3[0]avgminus = ftmp4endifRS = avgplus/avgminusDMIRSX = 100  100 / ( 1 + RS )return DMIRSX as "Dynamic Momentum Index", levelup style(dottedline) as "level up", leveldown style(dottedline) as "level down"01/25/2018 at 8:19 PM #60533 
AuthorPosts