[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: el bar ?



PureBytes Links

Trading Reference Links

> Only thing I have come up with is to calc an implied bar # for
> currentdate/currenttime (it is ok if this isn't perfect vis-a-vis
> holidays), but that seems like a pain, as I want it to work on every
> time frame. 

That will give you a good approximation, which sounds like it 
would be good enough for your needs.

Getting it to work on all timeframes is no biggie.  Just use 
BarInterval in your calculations:

  DaysLeft = DateToJulian(CurrentDate) - DateToJulian(Date);
  BarsPerDay = (TimeToMinutes(Sess1EndTime) -
                TimeToMinutes(Sess1StartTime)) / BarInterval;
  BarsLeft = DaysLeft * BarsPerDay;

That doesn't handle the bars between the current bar and the end 
of that day, nor the bars in the last partial day on the chart, 
but you can work that out.  Or just ignore them, if this gets you 
close enough.

Gary


  • References: