This script is just for reference to see the trading range. Do not use this strategy logic, it is just Test strategy. The trading range is colored depending on whether it is profitable or not. You can change the color if you want.
When you declare the strategy, put (process_orders_on_close=true,calc_on_every_tick=true, max_boxes_count=500) in your script. Then it can show you current open trading as well. If you use switching strategy (e.g longposition to shortposition right away), it may not show you the range properly. In that case, reduse the test period.
IT IS Repainting Reference.
If you want to see your strategy result visually, Just copy and paste from line 22 in my script.