Index Line on Chart With Top/Bottom Margins (MarketSurge)Adds an index line to the chart, along with configurable top/bottom margins. MarketSurge has the line in the top third/quarter of the chart area.
This script is unfortunately quite slow/laggy when zooming/scrolling. Unfortunately that is unavoidable, because to scale the visible portion of the index line it needs to access `left_visible_bar_time` and `right_visible_bar_time`. There are two issues with that. First, if a script access those variables, then it is reloaded on every zoom/scroll. So every time the chart is zoomed/scrolled, this script is reloaded and has to recalculate and draw everything from scratch. Second, TradingView has a couple of seconds delay built in before it will initiate the reload, presumably to allow the zoom/scroll to settle, and to avoid reloading on every zoom/scroll intermediate step. But that makes this script even less responsive, of course.
Tip: when using this indicator, you may also want to change the main chart's top margin to push the main plot down a bit (that setting does not affect the position of this indicator). See the "Margins" section in the Chart Setting's "Canvas" tab.
Pine Script® インジケーター






