Indicator and daytime

 

Hi,

I have two questions:

1.Why is the main Loop in an indicator f.e. BB_Oszillator running twice?

I don't know, why I have to substract one from the actuall counted_bars:

if(counted_bars>0) counted_bars--;

2.If I have a variable

datetime test;

How can I write 8:00 from the actual day in that variable??

THANK YOU!

 

1.a) I don't have the code so can't comment

1.b) if(counted_bars>0) counted_bars--; // done to allow ticks that span a bar to recalculate penultimate bar

2. something like (I'm just typing it - uncompiled & untested)

datetime myDateSometime = ... ;
datetime eightOnDay;
   eightOnDay = (myDateSometime / 86400) * 86400; // 86400 = secs/day
   eightOnDay += 8 * 3600; // 3600 = secs/hr
Reason: