Profile Picture

BarUtils.BarLookBackFromDate ?

Posted By kaizen 4 Years Ago
Posted Wednesday September 03 2014
When using this code
SystemData.Output.Add(OutputSeverityLevel.Informational, BarUtils.BarLookBackFromDate(SymbolScripts(indexSymbol).Bars, New Date(pos.Info.CloseDate.Year, pos.Info.CloseDate.Month, pos.Info.CloseDate.Month)), pos.Symbol)

It returns -1 for some trades even though there is data for the day specified. 
I use the same code but with the open date of the trade and this never through's an error but for some reason using the close date returns -1.
Any ideas?

Posted Friday September 05 2014
It looks like a typo.  You're passing in the month twice when you probably want to pass in the month and the day.

FYI, you can just use the Date property of a DateTime to get rid of the time instead of creating a new instance and passing in the year, month, and day.


Similar Topics

Reading This Topic

2005-2018 © RightEdge Systems