I want to get the OHLC data for last trading day. while searching Ninja Help Guide, i get to know Bars.GetDayBar() which suits my requirement.
But i tired calling this functions with possible combinations, but it is raising exception. Below is the code which i tried using.
Bars b = BarsArray[0];
Print(b.Count.ToString()); //Prints 2556 bars which is approx 10 days of data
Bar day = null;
for (int i = 0; i < 10; i++)
{
try
{
day = b.GetDayBar(i); //Always raise exception
}
catch { }
if (day != null)
break;
}
if (day == null)
Print("Day is null"); //Always prints null
Please tell me the best way to get previous OHLC data?
Thanks
Comment