NAS 3M RSIH & DMH V0.1 – John Ehlers
Forums › ProRealTime English forum › ProOrder support › NAS 3M RSIH & DMH V0.1 – John Ehlers
- This topic has 3 replies, 2 voices, and was last updated 2 years ago by GraHal.
Viewing 4 posts - 1 through 4 (of 4 total)
-
-
01/18/2022 at 2:57 PM #185837
I have made an attempt at a strategy that combines John Ehlers Yet Another Improved RSI – RSIH & John Ehlers DMH – AN IMPROVED DIRECTIONAL MOVEMENT INDICATOR
Both of these indicators are coded by Bruno CarnazziWhat do you think. How can we make it better?
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated//SnorreDK:s Stratetgy cobined of TASC DEC 2021 RSIH and DMH - Directional Movement using Hann WindowingSll = 1.3 // Stoploss longSLs = 2 // Stoploss short//Indicator: TASC DEC 2021 RSIH// TASC JAN 2022// RSIH - RSI with Hann Windowing// (C) 2005-2021 John F. Ehlers// Parameters// Accumulate "Closes Up" and "Closes Down"CU = 0CD = 0RSILength=14for count = 1 to RSILength doif Close[count - 1] - Close[count] > 0 thenCU = CU + (1 - cos(360*count / (RSILength + 1))) * (Close[count - 1] - Close[count])endifif Close[count] - Close[count - 1]> 0 thenCD = CD + (1 - cos(360*count / (RSILength + 1))) *(Close[count] - Close[count - 1])endifnextif CU + CD <> 0 thenMyRSI = (CU - CD) / (CU + CD)endifc2 = (MyRSI > 0.5)c4 = (MyRSI < -0.7)//--------------------------------// DMH - Directional Movement using Hann Windowing// (C) 2021 John F. Ehlers// ParametersLength= 14// Varsonce DMH = 0once EMA = 0once SF = 1 / Lengthif barindex > Length thenUpperMove = High - High[1]LowerMove = Low[1] - LowPlusDM = 0MinusDM = 0If UpperMove > LowerMove and UpperMove > 0 ThenPlusDM = UpperMoveElsIf LowerMove > UpperMove and LowerMove > 0 ThenMinusDM = LowerMoveendifEMA = SF*(PlusDM - MinusDM) + (1 - SF)* EMA[1]//Smooth Directional Movements with Hann Windowed FIR filterDMSum = 0coef = 0For count = 1 to Length doDMSum = DMSum + (1 - cos(360*count / (Length + 1)))*EMA[count - 1]coef = coef + (1 - cos(360*count / (Length + 1)))nextIf coef <> 0 ThenDMH = DMSum / coefendifendifc1 = (DMH CROSSES OVER 0)c3 = (DMH CROSSES under 0)//------------------------------------CB1 = C1 and C2IF CB1 THENBUY 1 CONTRACT AT MARKETSET STOP %LOSS SLlENDIFCS1 = C3 and C4IF CS1 THENSELLSHORT 1 CONTRACT AT MARKETSET STOP %LOSS SLsENDIFMS=0TGL=10TGS=6TRP=14// TRAILINGSTOP//----------------------------------------------atrtrail = averagetruerange[TRP]((close/10)*pipsize)/1000trailingstartl = round(atrtrail*TGL)trailingstarts = round(atrtrail*TGS)if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thenmaxprice = 0minprice = closeexitprice = 0endifif longonmarket thenmaxprice = max(maxprice,close)if maxprice-tradeprice(1)>=trailingstartl*pointsize thenif maxprice-tradeprice(1)>=MS thenexitprice = maxprice-trailingstartl*pointsizeelseexitprice = maxprice - MS*pointsizeendifendifendifif shortonmarket thenminprice = min(minprice,close)if tradeprice(1)-minprice>=trailingstarts*pointsize thenif tradeprice(1)-minprice>=MS thenexitprice = minprice+trailingstarts*pointsizeelseexitprice = minprice + MS*pointsizeendifendifendifif onmarket and exitprice>0 thenexitshort at exitprice stopsell at exitprice stopendif2 users thanked author for this post.
01/18/2022 at 4:26 PM #18584401/18/2022 at 5:25 PM #18585401/18/2022 at 7:02 PM #185868 -
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)