How to Check for No signals in past 2 Sessions / Days

I need to check if a signal has come in exact 2 days / 2 sessions or not.

So it's simple to check the count of signals using

Sum(Ref(Buy,-1),750)

750 being the the count of 1 minute bars in 2 days (2 sessions). However, not all symbols trade for all those 750 bars. So it is prone to calculate for more than 2 days / 2 sessions.

I need to use something like

Day()

which actually cares only for dates.

Any hints on how to achieve this?

dn = DateNum();
newday = dn != Ref( dn, -1);
bars = BarsSince(newday)+1;
bars_twoDays = Valuewhen(newday,Ref(bars,-1)) + bars;

2 Likes

So bars variable kept track of number of bars and then you added yesterday's bars variable last count to latest bars variable count.

So, this +1 here:

bars = BarsSince(newday)+1;

this is to include the current ongoing bar which is not completed yet?

Thanks for your help.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.