Here i have made a kind of MACD indicator from the halftrend indicator from the Great NICOLAS, after the improvement from him , I want to shared with everybody.
The histogram is made from the difference of 2 HalfTrend indicator (one long and one short period), then a signal line, built with an average of 6 periods of the histogram values is added.
Trades signals are the same than a normal MACD: long position when the histogram is crossing the zero line, short order when the histogram cross the zero level. The signal line can act the same, any crosses made with the histogram could result as an new order on market:
- short signal when the signal line cross above the histogram and above the zero level
- long signal when the signal line cross below the histogram and below the zero level
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
//PRC_HalfTrend MACD | indicator //10.03.2017 //by LUCASSEN adapted code from //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //Amplitude1 = 2 //Amplitude2 = 6 //Amplitude3 = 30 // -- HL #1 lowpricei1 = Lowest[Amplitude1](low) highpricei1 = Highest[Amplitude1](high) lowma1 = average[Amplitude1](low) highma1 = average[Amplitude1](high) if barindex>Amplitude1 then if(nexttrend1=1) then maxlowprice1=Max(lowpricei1,maxlowprice1) if(highma1<maxlowprice1 and Close<Low[1]) then trend1=1.0 nexttrend1=0 minhighprice1=highpricei1 endif endif if(nexttrend1=0) then minhighprice1=Min(highpricei1,minhighprice1) if(lowma1>minhighprice1 and Close>High[1]) then trend1=0.0 nexttrend1=1 maxlowprice1=lowpricei1 endif endif if(trend1=0.0) then if(trend1[1]<>0.0) then up1=down1[1] else up1=Max(maxlowprice1,up1[1]) endif down1=0.0 else if(trend1[1]<>1.0) then down1=up1[1] else down1=Min(minhighprice1,down1[1]) endif up1=0.0 endif endif // -- HL #2 lowpricei2 = Lowest[Amplitude2](low) highpricei2 = Highest[Amplitude2](high) lowma2 = average[Amplitude2](low) highma2= average[Amplitude2](high) if barindex>Amplitude2 then if(nexttrend2=1) then maxlowprice2=Max(lowpricei2,maxlowprice2) if(highma2<maxlowprice2 and Close<Low[1]) then trend2=1.0 nexttrend2=0 minhighprice2=highpricei2 endif endif if(nexttrend2=0) then minhighprice2=Min(highpricei2,minhighprice2) if(lowma2>minhighprice2 and Close>High[1]) then trend2=0.0 nexttrend2=1 maxlowprice2=lowpricei2 endif endif if(trend2=0.0) then if(trend2[1]<>0.0) then up2=down2[1] else up2=Max(maxlowprice2,up2[1]) endif down2=0.0 else if(trend2[1]<>1.0) then down2=up2[1] else down2=Min(minhighprice2,down2[1]) endif up2=0.0 endif endif if up2>0 then halftrend2 = up2 else halftrend2 = down2 endif // -- HL #3 lowpricei3 = Lowest[Amplitude3](low) highpricei3 = Highest[Amplitude3](high) lowma3 = average[Amplitude3](low) highma3= average[Amplitude3](high) if barindex>Amplitude3 then if(nexttrend3=1) then maxlowprice3=Max(lowpricei3,maxlowprice3) if(highma3<maxlowprice3 and Close<Low[1]) then trend3=1.0 nexttrend3=0 minhighprice3=highpricei3 endif endif if(nexttrend3=0) then minhighprice3=Min(highpricei3,minhighprice3) if(lowma3>minhighprice3 and Close>High[1]) then trend3=0.0 nexttrend3=1 maxlowprice3=lowpricei3 endif endif if(trend3=0.0) then if(trend3[1]<>0.0) then up3=down3[1] else up3=Max(maxlowprice3,up3[1]) endif down3=0.0 else if(trend3[1]<>1.0) then down3=up3[1] else down3=Min(minhighprice3,down3[1]) endif up3=0.0 endif endif if up3>0 then halftrend3 = up3 else halftrend3 = down3 endif return (halftrend2 - halftrend3),average[6] (halftrend2 - halftrend3) |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
amplitude 1.2.3 = ( 2-6-30 ) or (1-1-27) ?
Hallo Supertiti
Macd amplitude=1-1-27 and prc halftrend triple in Heikin Ashi grafiek amplitude =2-6-10
greetings Lucassen
Thanks you so much Lucassen
hi, copied the above code, not working on 10.3
the system says “return can only be used at proBuilder….what do i have todo ?
Hallo , i have no problem , and i have the same versie 10.3, maybe you can ask Nicolas, that men nows a lot over indicators.
greetings Lucassen