1-2-3 Pivots Support and Resistance Lines On Any Indicator
Forums › ProRealTime English forum › ProBuilder support › 1-2-3 Pivots Support and Resistance Lines On Any Indicator
- This topic has 3 replies, 2 voices, and was last updated 3 years ago by robertogozzi.
-
-
01/23/2019 at 11:49 AM #89417
I made a modification to my 1-2-3 Pivots Support and Resistance Lines indicator that can be found here:
https://www.prorealcode.com/prorealtime-indicators/1-2-3-pivots-support-and-resistance-lines/
I’m not sure if it is a significant enough new version for a new library post so I will just post it here and add a link to the original indicators comments (unless Nicolas thinks it should be in the library?)
This new version allows you to plot the support and resistance lines (and averages of them) that are based on the last three high and last three low points on to an indicator rather than onto price. Just change the indicator in line 18 to the indicator of your choice. In the example here it is a fast average of RSI[14] but if you want a different indicator then change it to MyIndicator = Stochastic[5,10] for example.
Breakout of support and resistance lines by an indicator can indicate a change of direction or the start of a new trend. The slope of the lines can be used to spot divergence between an indicator and price. Hopefully this new version of my indicator will be useful to someone.
Here is the ITF file:
Pivots123-Sup-Res-On-Indicator
…and the code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174//Pivots123 Support and Resistance Lies On Indicator//By Vonasi//20190123//DEFPARAM CalculateOnLastBars = 1000//BarsAfter = 1//BarsBefore = 1//Pivots12 = 1//Pivots13 = 1//Pivots23 = 1//Avg12 = 1//Avg123 = 1//Avg12Mid = 1//Avg123 = 1//Connected = 1MyIndicator = exponentialaverage[5](RSI[14](customclose)) // Replace the indicator here with the indicator of your choice.BarLookBack = BarsAfter + 1IF MyIndicator[BarsAfter] < lowest[BarsBefore](MyIndicator)[BarLookBack] THENIF MyIndicator[BarsAfter] = lowest[BarLookBack](MyIndicator) THENSupport = MyIndicator[BarsAfter]ENDIFENDIFIF MyIndicator[BarsAfter] > highest[BarsBefore](MyIndicator)[BarLookBack] THENIF MyIndicator[BarsAfter] = highest[BarLookBack](MyIndicator) THENResistance = MyIndicator[BarsAfter]ENDIFENDIFcr12 = 0cr13 = 0cr23 = 0cs12 = 0cs13 = 0cs23 = 0csave3 = 0crave3 = 0csave2 = 0crave2 = 0cave3mid = 0cave2mid = 0if pivots12 thencr12 = 255cs12 = 255endifif pivots13 thencr13 = 255cs13 = 255endifif pivots23 thencr23 = 255cs23 = 255endifif avg123 thencrave3 = 255csave3 = 255endifif avg12 thencrave2 = 255csave2 = 255endifif avg123mid thencave3mid = 255endifif avg12mid thencave2mid = 255endifif resistance <> resistance[1] thenhi3 = hi2hi2 = hi1hi3index = hi2indexhi2index = hi1indexhi1 = MyIndicator[BarsAfter]hi1index = BarIndex[BarsAfter]if not connected thencr12 = 0cr13 = 0cr23 = 0crave3 = 0crave2 = 0cave2mid = 0cave3mid = 0endifendifif support <> support[1] thenlo3 = lo2lo2 = lo1lo3index = lo2indexlo2index = lo1indexlo1 = MyIndicator[BarsAfter]lo1index = BarIndex[BarsAfter]if not connected thencs12 = 0cs13 = 0cs23 = 0csave3 = 0csave2 = 0cave2mid = 0cave3mid = 0endifendif//12if hi2 > hi1 thennexthi12 = hi1 - (((hi2 - hi1) / (hi1index - hi2index)) * (barindex - hi1index))endifif hi2 < hi1 thennexthi12 = hi1 + (((hi1 - hi2) / (hi1index - hi2index)) * (barindex - hi1index))endifif lo2 > lo1 thennextlo12 = lo1 - (((lo2 - lo1) / (lo1index - lo2index)) * (barindex - lo1index))endifif lo2 < lo1 thennextlo12 = lo1 + (((lo1 - lo2) / (lo1index - lo2index)) * (barindex - lo1index))endif//13if hi3 > hi1 thennexthi13 = hi1 - (((hi3 - hi1) / (hi1index - hi3index)) * (barindex - hi1index))endifif hi3 < hi1 thennexthi13 = hi1 + (((hi1 - hi3) / (hi1index - hi3index)) * (barindex - hi1index))endifif lo3 > lo1 thennextlo13 = lo1 - (((lo3 - lo1) / (lo1index - lo3index)) * (barindex - lo1index))endifif lo3 < lo1 thennextlo13 = lo1 + (((lo1 - lo3) / (lo1index - lo3index)) * (barindex - lo1index))endif//23if hi3 > hi2 thennexthi23 = hi2 - (((hi3 - hi2) / (hi2index - hi3index)) * (barindex - hi1index))endifif hi3 < hi2 thennexthi23 = hi2 + (((hi2 - hi3) / (hi2index - hi3index)) * (barindex - hi1index))endifif lo3 > lo2 thennextlo23 = lo2 - (((lo3 - lo2) / (lo2index - lo3index)) * (barindex - lo1index))endifif lo3 < lo2 thennextlo23 = lo2 + (((lo2 - lo3) / (lo2index - lo3index)) * (barindex - lo1index))endifnextloave3 = (nextlo12 + nextlo13 + nextlo23)/3nexthiave3 = (nexthi12 + nexthi13 + nexthi23)/3nextloave2 = (nextlo12 + nextlo13)/2nexthiave2 = (nexthi12 + nexthi13)/2ave123mid = (nexthiave3 + nextloave3)/2ave12mid = (nexthiave2 + nextloave2)/2RETURN 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", MyIndicator style(line,2) as "My Indicator"01/23/2019 at 1:36 PM #8943002/18/2021 at 10:59 AM #16190302/18/2021 at 11:38 AM #161908I can download it as a regular ITF file.
You might have mistakingly set ITF files to be opened with Acrobat Reader.
Go to your settings and change the default APP/Program to open those files.
-
AuthorPosts
Find exclusive trading pro-tools on