This indicator draws support and resistance lines that are an extension of the last three swing highs and last three swing lows (or fractal points). It is an updated version of my indicator that can be found here:
https://www.prorealcode.com/prorealtime-indicators/last-two-pivots-support-and-resistance-lines/
Whenever a new pivot point is formed a new support or resistance line starts to be drawn that lines up with previous pivot points.
In this new version the last three swing highs and last three swing lows are used. By ticking or unticking the relevant box various support and resistance lines can be displayed or removed as follows:
- Pivots12 – Lines that are a continuation of a line connecting the last two high and low pivots.
- Pivots13 – Lines that are a continuation of a line connecting the last and the second to last high and low pivots.
- Pivots23 – Lines that are a continuation of a line connecting the second to last and third to last high and low pivots.
- Avg12 – Lines that are an average of the Pivots12 and Pivots13 lines.
- Avg123 – Lines that are an average of the Pivots12, Pivots13 and Pivots23 lines.
- Avg12Mid – A line that is mid way between the Avg12 support and resistance lines.
- Avg123Mid – A line that is mid way between the Avg123 support and resistance lines.
- Connected – All lines are drawn connected when a new pivot high or pivot low is formed
The pivot/fractals definition can be adjusted by changing the number of bars before and the number of bars after the high or low. So for example you can have a new pivot whenever a high has one candle lower either side of it or when it has two candles lower either side of it.
This indicator can be used to easily see if price is either bouncing off of support and resistance or if it is breaking out from support or resistance.
Download and import the ITF file to get full functionality.
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 |
//Last 1-2-3 Pivots Support and Resistance Lines //By Vonasi //18011919 //DEFPARAM CalculateOnLastBars = 1000 //BarsAfter = 1 //BarsBefore = 1 //Pivots12 = 1 //Pivots13 = 1 //Pivots23 = 1 //Avg12 = 1 //Avg123 = 1 //Avg12Mid = 1 //Avg123 = 1 //Connected = 1 BarLookBack = BarsAfter + 1 IF low[BarsAfter] < lowest[BarsBefore](low)[BarLookBack] THEN IF low[BarsAfter] = lowest[BarLookBack](low) THEN Support = low[BarsAfter] ENDIF ENDIF IF high[BarsAfter] > highest[BarsBefore](high)[BarLookBack] THEN IF high[BarsAfter] = highest[BarLookBack](high) THEN Resistance = high[BarsAfter] ENDIF ENDIF cr12 = 0 cr13 = 0 cr23 = 0 cs12 = 0 cs13 = 0 cs23 = 0 csave3 = 0 crave3 = 0 csave2 = 0 crave2 = 0 cave3mid = 0 cave2mid = 0 if pivots12 then cr12 = 255 cs12 = 255 endif if pivots13 then cr13 = 255 cs13 = 255 endif if pivots23 then cr23 = 255 cs23 = 255 endif if avg123 then crave3 = 255 csave3 = 255 endif if avg12 then crave2 = 255 csave2 = 255 endif if avg123mid then cave3mid = 255 endif if avg12mid then cave2mid = 255 endif if resistance <> resistance[1] then hi3 = hi2 hi2 = hi1 hi3index = hi2index hi2index = hi1index hi1 = high[BarsAfter] hi1index = BarIndex[BarsAfter] if not connected then cr12 = 0 cr13 = 0 cr23 = 0 crave3 = 0 crave2 = 0 cave2mid = 0 cave3mid = 0 endif endif if support <> support[1] then lo3 = lo2 lo2 = lo1 lo3index = lo2index lo2index = lo1index lo1 = low[BarsAfter] lo1index = BarIndex[BarsAfter] if not connected then cs12 = 0 cs13 = 0 cs23 = 0 csave3 = 0 csave2 = 0 cave2mid = 0 cave3mid = 0 endif endif //12 if hi2 > hi1 then nexthi12 = hi1 - (((hi2 - hi1) / (hi1index - hi2index)) * (barindex - hi1index)) endif if hi2 < hi1 then nexthi12 = hi1 + (((hi1 - hi2) / (hi1index - hi2index)) * (barindex - hi1index)) endif if lo2 > lo1 then nextlo12 = lo1 - (((lo2 - lo1) / (lo1index - lo2index)) * (barindex - lo1index)) endif if lo2 < lo1 then nextlo12 = lo1 + (((lo1 - lo2) / (lo1index - lo2index)) * (barindex - lo1index)) endif //13 if hi3 > hi1 then nexthi13 = hi1 - (((hi3 - hi1) / (hi1index - hi3index)) * (barindex - hi1index)) endif if hi3 < hi1 then nexthi13 = hi1 + (((hi1 - hi3) / (hi1index - hi3index)) * (barindex - hi1index)) endif if lo3 > lo1 then nextlo13 = lo1 - (((lo3 - lo1) / (lo1index - lo3index)) * (barindex - lo1index)) endif if lo3 < lo1 then nextlo13 = lo1 + (((lo1 - lo3) / (lo1index - lo3index)) * (barindex - lo1index)) endif //23 if hi3 > hi2 then nexthi23 = hi2 - (((hi3 - hi2) / (hi2index - hi3index)) * (barindex - hi1index)) endif if hi3 < hi2 then nexthi23 = hi2 + (((hi2 - hi3) / (hi2index - hi3index)) * (barindex - hi1index)) endif if lo3 > lo2 then nextlo23 = lo2 - (((lo3 - lo2) / (lo2index - lo3index)) * (barindex - lo1index)) endif if lo3 < lo2 then nextlo23 = lo2 + (((lo2 - lo3) / (lo2index - lo3index)) * (barindex - lo1index)) endif nextloave3 = (nextlo12 + nextlo13 + nextlo23)/3 nexthiave3 = (nexthi12 + nexthi13 + nexthi23)/3 nextloave2 = (nextlo12 + nextlo13)/2 nexthiave2 = (nexthi12 + nexthi13)/2 ave123mid = (nexthiave3 + nextloave3)/2 ave12mid = (nexthiave2 + nextloave2)/2 RETURN nexthi12 coloured(0,128,0,cr12) style(line,1) as "Resistance12", nextlo12 coloured (128,0,0,cs12) style(line,1) as "Support12", nexthi13 coloured(0,128,0,cr13) style(line,1) as "Resistance13", nextlo13 coloured (128,0,0,cs13) style(line,1) as "Support13", nexthi23 coloured(0,128,0,cr23) style(line,1) as "Resistance23", nextlo23 coloured (128,0,0,cs23) style(line,1) as "Support23", nexthiave3 coloured(0,128,0,crave3) style(line,1) as "Resistance Average 1-2-3", nextloave3 coloured (128,0,0,csave3) style(line,1) as "Support Average 1-2-3", nexthiave2 coloured(0,128,0,crave2) style(line,1) as "Resistance Average 1-2", nextloave2 coloured (128,0,0,csave2) style(line,1) as "Support Average 1-2", ave123mid coloured (0,0,255,cave3mid) style(line,1) as "Average Mid 1-2-3", ave12mid coloured (0,0,255,cave2mid) style(line,1) as "Average Mid 1-2" |
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
There is another version of this indicator that can plot the same lines but onto an indicator rather than on to price. It can be found here:
https://www.prorealcode.com/topic/1-2-3-pivots-support-and-resistance-lines-on-any-indicator/
Hello Vonasi, do you think it is possible with PRT to code with the same principle as on this indicator of :
– Bullish and bearish triangles
– Ascending and descending bees
– Bullish and downside breakouts
I do not know if technically, the platform could allow this kind of code.