It derives from the indicator at https://www.prorealcode.com/prorealtime-indicators/pivot-support-resistance-zones/, following a request from a user’s comment at that indicator.
It simply uses an MA (Ema by default) to build bands and a middle line based on those pivots segments, according to the chosen periods.
It’s quite self-explanatory.
In the attached screnshot there are 3 pics:
- Original indicator (left)
- Bands built on a 2-period Ema (upper right)
- Bands built on a 50-period Ema (lower right)
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 |
// Pivot Support & Resistance Bands // // https://www.prorealcode.com/prorealtime-indicators/pivot-support-resistance-zones/ // DEFPARAM CalculateOnLastBars = 1000 //p = 2 //2 periods //Type = 1 //1 = Ema p = max(1,min(999,p)) //range 1 - 999 Type = max(0,min(6,Type)) //range 0 - 6 PivotBAR = 2 //2 bars AFTER pivot LookBack = 4 //4 bars BEFORE pivot BarLookBack = PivotBAR + 1 IF low[PivotBAR] < lowest[LookBack](low)[BarLookBack] THEN IF low[PivotBAR] = lowest[BarLookBack](low) THEN //MySupport = BarIndex - PivotBAR SupportPrice = low[PivotBAR] ENDIF ENDIF IF high[PivotBAR] > highest[LookBack](high)[BarLookBack] THEN IF high[PivotBAR] = highest[BarLookBack](high) THEN //MyResistance = BarIndex - PivotBAR ResistancePrice = high[PivotBAR]//high[BarIndex - MyResistance] ENDIF ENDIF EmaResistance = average[p,Type](ResistancePrice) EmaSupport = average[p,Type](SupportPrice) MidLine = EmaSupport + ((EmaResistance - EmaSupport) / 2) //DRAWSEGMENT(MyResistance,ResistancePrice,BarIndex,ResistancePrice) COLOURED(255,0,0,255) //DRAWSEGMENT(MySupport,SupportPrice,BarIndex,SupportPrice) COLOURED(0,128,0,255) RETURN EmaResistance COLOURED(255,0,0,255) AS "EmaResistance",EmaSupport COLOURED(0,128,0,255) AS "EmaSupport",MidLine coloured(0,0,0,32) AS "MidLine" |
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