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.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publications is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.