How to code : plot indicator in selected range on the chart ?

 
How to code : plot indicator in selected range on the chart ?
 
Hoummad Elkraima :
How to code : plot indicator in selected range on the chart ?

First, you need to clearly define what "range on the chart" is. Secondly, inside the indicator, it is necessary to check the truth of the condition all the time and, depending on the result, either draw the indicator line or not draw it.