Ignore Extended Session Code

Looking at the extended session is awesome and can certainly give you an edge on trading the open of a market. If you're more of a technical trader, though, you run into the problem of the extended session data throwing your indicators off. To fix that, use the code below as a template for whatever indicators you use.
Open-source 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 a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


HI there. Thanks for this. I'm pretty sure you can use 'output = security(t, period, moving_average, lookahead=barmerge.lookahead_on)' to get the same output in ver3 as you do in ver2
@scarf, That was something initially suggested by the TV tech support team, but it didn't have the desired effect. The problem is that, in ver3, when you set it to ignore the extended session, Pine displaces where the session is by one bar. So, you end up not calculating the data from the last bar of the session and including the last bar from the extended session. Now, that may not be the end of the world if you're using a 200 period moving average on a 1 minute chart, but it can make a huge difference if you're looking at an 8 period moving average on a 15 minute chart.
scarf josh_kaprun
@josh_kaprun, Hmmm, this might explain why I can't get an hourly period to signal in one of my indicators. Will look into it, thanks!
@scarf, Glad to help. Good luck!
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter