Reference only market-hour bars

V

Variety_Jones

New member
VIP
Hey all,

I'm trying to create a simple scanner/indicator to return true if the volavg of the past 5 bars is double what it was yesterday at the same time (and it only runs from 9:45 - 9:50. It's on a 5minute chart and the way I'm trying to reference yesterdays volavg at the same time is volavg[90] but I think TOS is counting the pre-market/after-hours bars as well and therefor 90 bars ago is in the middle of the day yesterday. Anyone know how to reference only market-hour bars in thinkscript? Here's what I got so far.

Code:
input length = 3;

def Vol = volume;
def VolAvg = Average(volume, length);

input OpenTime = 0930;
input DurationHours = 1;

def durationSec = DurationHours * 60 * 60;
def secondsPassed = SecondsFromTime(OpenTime);

plot Data = volavg > (volavg[90]*2) and secondspassed <= 1200 and secondspassed >= 900;

The reason I'm suspicious is because I'm getting a lot of false signals. Any ideas?

Thanks in advance!
 

Similar threads

Top