Help Requested - Mark and delete horizontal lines based on Current Price

#1
Dear Members,
Request you to please help with AFL (currently plotting manually) for adding and deleting horizontal lines based on current price. Say for example, if Bergepaint is @ 281, I should be able to plot 283, 285, 287, 290, 292 (on higher side) and 276, 273, 268,etc (prices are random based on previous highs and lows / some other criteria). Now, the price goes to 300, should be able to plot (on running afl) 305,307,311,315, etc. AND, the earlier drawn trend lines (when price was 281) to be removed (to avoid clutter on the chart).
Similarly, if BajajFinsv is @5726, it should be able to plot the horizontal lines and delete them when the prices change.

--------------------
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
Val=iif ((Close < 2800 AND Close > 2700), (Plot (2745,"",colorGold,styleDashed) AND Plot (2765,"",colorBlue,styleLine)),Null);
---------------------

In the above, I am able to get the lines - but upto current price bar only. Would prefer to have horizontal lines. Also, not aware how to remove the lines if the price changes.
Will do the coding for different price ranges manually.
But looking for help on AFL coding for plotting and removing lines (when price changes - to avoid clutter on the chart)

Requesting experts to help please

warm regards-RB
 

Similar threads