Thank you very much Minitrader.
You are welcome but I actually attached the wrong one. I am attaching one that is still a work in progress with sensitivity, "far away" and colors in parameters (no style yet) but it will get what you want I hope. It sticks to the last highs and lows and has some ability to change some options in your parameter window. They are dynamic so depending on where you click on the chart is where they appear. They show highs and lows
behind where you click. Here is the code:
_____________________________________________________________
#pragma nocache
// Commentry output ....
EnableTextOutput(False);
AudioAlert = ParamToggle("Audio Alert", "On|Off");
Print_SR = ParamToggle("Sup / Res", "On|Off");
Text_Display = ParamToggle("Alert Messages", "On|Off"); // Display Alert messages on Chart.
_SECTION_BEGIN("DT /DB Parameters");
DT_DB_Sens = Param("Sensitivity % ", 0.15, 0.1, 2.0, 0.05);
DT_DB_Range = Param("How Many Periods ?", 14, 2, 200, 1);
_SECTION_END();
_SECTION_BEGIN("S / R Parameters");
Sensitivity = Param("Sensitivity",32,0,100,1);
DisRange = Param("Plot 'far away' Lines Trigger",300,0,1000,20);
Color_SL= ParamColor("Support",colorLime);
Color_RL= ParamColor("Resistance",colorRed);
_SECTION_END();
Plot( MA( C, 21 ), _DEFAULT_NAME(), ParamColor("Color", colorBlack ),1+ 4096+styleNoTitle );
NiftyConditions30();
per1 = SelectedValue(Sensitivity *SelectedValue(0.2*uIV_AVG30));
per2 = SelectedValue(per1 * 3);
x=Cum(1);
Tp1 = TroughBars(L,per1,1) == 0;
Pp1 = PeakBars (H,per1,1) == 0;
Tp2 = TroughBars(L,per2,1) == 0;
Pp2 = PeakBars (H,per2,1) == 0;
XT1 =SelectedValue(ValueWhen(Tp1,x,1));
XT2 =SelectedValue(ValueWhen(Tp1,x,2));
XT3 =SelectedValue(ValueWhen(Tp1,x,3));
XT4 =SelectedValue(ValueWhen(Tp1,x,4));
XT5 =SelectedValue(ValueWhen(Tp1,x,5));
XT6 =SelectedValue(ValueWhen(Tp2,x,1));
XT7 =SelectedValue(ValueWhen(Tp2,x,2));
XP1 =SelectedValue(ValueWhen(Pp1,x,1));
XP2 =SelectedValue(ValueWhen(Pp1,x,2));
XP3 =SelectedValue(ValueWhen(Pp1,x,3));
XP4 =SelectedValue(ValueWhen(Pp1,x,4));
XP5 =SelectedValue(ValueWhen(Pp1,x,5));
XP6 =SelectedValue(ValueWhen(Pp2,x,1));
XP7 =SelectedValue(ValueWhen(Pp2,x,2));
T1 = SelectedValue(ValueWhen(Tp1,L,1));
T2 = SelectedValue(ValueWhen(Tp1,L,2));
T3 = SelectedValue(ValueWhen(Tp1,L,3));
T4 = SelectedValue(ValueWhen(Tp1,L,4));
T5 = SelectedValue(ValueWhen(Tp1,L,5));
T6 = SelectedValue(ValueWhen(Tp2,L,1));
T7 = SelectedValue(ValueWhen(Tp2,L,2));
P1 = SelectedValue(ValueWhen(Pp1,H,1));
P2 = SelectedValue(ValueWhen(Pp1,H,2));
P3 = SelectedValue(ValueWhen(Pp1,H,3));
P4 = SelectedValue(ValueWhen(Pp1,H,4));
P5 = SelectedValue(ValueWhen(Pp1,H,5));
P6 = SelectedValue(ValueWhen(Pp2,H,1));
P7 = SelectedValue(ValueWhen(Pp2,H,2));
breakout_lasttrough_G1 = Cross(T1,C);
breakout_lasttrough_G2 = Cross(T6,C);
breakout_lastpeak_G1 = Cross(C,P1);
breakout_lastpeak_G2 = Cross(C,P6);
bu_breakout = Cross(C,P1) OR Cross(C,P6);
be_breakout = Cross(T1,C) OR Cross(T6,C);
break_G1_val = IIf(breakout_lasttrough_G1,-1,IIf(breakout_lastpeak_G1,1,0));
break_G2_val = IIf(breakout_lasttrough_G2,-1,IIf(breakout_lastpeak_G2,1,0));
Vis_percent =DisRange*SelectedValue(MA(abs(ROC(C,1)),10));
pR = (Vis_percent/100) + 1;
nR = ((100-VIS_percent)/100);
lC = SelectedValue(C);
RT1 = T1<PR*LC & T1>nR*LC;
RT2 = T2<PR*LC & T2>nR*LC;
RT3 = T3<PR*LC & T3>nR*LC;
RT4 = T4<PR*LC & T4>nR*LC;
RT5 = T5<PR*LC & T5>nR*LC;
RP1 = P1<PR*LC & P1>nR*LC;
RP2 = P2<PR*LC & P2>nR*LC;
RP3 = P3<PR*LC & P3>nR*LC;
RP4 = P4<PR*LC & P4>nR*LC;
RP5= P5<PR*LC & P5>nR*LC;
RT6= T6<PR*LC & T6>nR*LC;
RT7= T7<PR*LC & T7>nR*LC;
RP6= P6<PR*LC & P6>nR*LC;
RP7= P7<PR*LC & P7>nR*LC;
AnZ= T1==0 & T2==0 & T3==0 & T4==0 & T5==0 & T6==0 & T7==0 & P1==0 & P2==0 & P3==0 & P4==0 & P5==0 & P6==0 & P7==0;
LastBar = Cum(1) == SelectedValue(Cum(1));
if(NOT Print_SR)
{
Plot(IIf(x>=XT1 & RT1 &NOT T1==0,T1,-1e10),"T1",colorBlue,1 + 2048+styleNoTitle);
Plot(IIf(x>=XT2 & RT2 &NOT T2==0,T2,-1e10),"T2",IIf( SelectedValue(C)<T2,Color_RL, Color_SL ),1 + 2048+styleNoTitle);
Plot(IIf(x>=XT3 & RT3 &NOT T3==0,T3,-1e10),"T3",IIf( SelectedValue(C) < T3 , Color_RL, Color_SL ),1 + 2048+styleNoTitle);
Plot(IIf(x>=XT4 & RT4 &NOT T4==0,T4,-1e10),"T4",IIf( SelectedValue(C)<T4,Color_RL, Color_SL ),1 + 2048+styleNoTitle);
Plot(IIf(x>=XT5 & RT5 &NOT T5==0,T5,-1e10),"T5",IIf( SelectedValue(C)<T5,Color_RL, Color_SL ),1 + 2048+styleNoTitle);
Plot(IIf(x>=XP1 & RP1 &NOT P1==0,P1,-1e10), "P1" ,colorBlue,1 + 2048+styleNoTitle);
Plot(IIf(x>=XP2 & RP2 &NOT P2==0,P2,-1e10), "P2" ,IIf( SelectedValue(C)<P2,Color_RL, Color_SL ),1 + 2048+styleNoTitle);
Plot(IIf(x>=XP3 & RP3 &NOT P3==0,P3,-1e10), "P3" ,IIf( SelectedValue(C)<P3,Color_RL, Color_SL ),1 + 2048+styleNoTitle);
Plot(IIf(x>=XP4 & RP4 &NOT P4==0,P4,-1e10), "P4" ,IIf( SelectedValue(C)<P4,Color_RL, Color_SL ),1 + 2048+styleNoTitle);
Plot(IIf(x>=XP5 & RP5 &NOT P5==0,P5,-1e10),"P5",IIf( SelectedValue(C)<P5,Color_RL, Color_SL ),1 + 2048+styleNoTitle);
Plot(IIf(x>=XT6 & RT6 &NOT T6==0,T6,-1e10),"T6",IIf( SelectedValue(C)<T6,Color_RL, Color_SL ),8 + 2048+styleNoTitle);
Plot(IIf(x>=XT7 & RT7 &NOT T7==0,T7,-1e10),"T7",IIf( SelectedValue(C)<T7,Color_RL, Color_SL ),8 + 2048+styleNoTitle);
Plot(IIf(x>=XP6 & RP6 &NOT P6==0,P6,-1e10),"P6",IIf( SelectedValue(C)<P6,Color_RL, Color_SL ),8 + 2048+styleNoTitle);
Plot(IIf(x>=XP7 & RP7 &NOT P7==0,P7,-1e10),"P7",IIf( SelectedValue(C)<P7,Color_RL, Color_SL ),8 + 2048+styleNoTitle);
}
________________________________________________________
And a screenshot and you will see the last high and low are another color:
Hope this helps better than the last one.