TradingView
josh_kaprun
30 Th06 2018 12:18

Ignore Extended Session Code 

Apple Inc.NASDAQ

Mô tả

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.
Bình luận
scarf
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
josh_kaprun
@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, Hmmm, this might explain why I can't get an hourly period to signal in one of my indicators. Will look into it, thanks!
josh_kaprun
@scarf, Glad to help. Good luck!
Thêm nữa