If I load more than 4 days of data and then load my indicator with a command to execute a Print() in the output window, the printed data repeats itself and loses order.
An example with the same type of code as my indicator.
private List<string> dateBarPositionEntry = new List<string> { "0" };
protected override void OnBarUpdate()
{
if (CurrentBar < 3)
return;
if (Low[0] < Low[1])
{
string date = Time[0].ToShortDateString() + "," + Time[0].DayOfYear.ToString() + "," + Time[0].DayOfWeek.ToString() + "," + Time[0].ToShortTimeString();
dateBarPositionEntry.Insert(0, date);
}
if (Bars.IsLastBarOfSession)
{
for(int i = 0; i <= dateBarPositionEntry.Count - 1; i++)
{
Print(dateBarPositionEntry[i]);
}
}
}
What is wrong? My list is incorrect?
By the way, my goal with this condition "if (Bars.IsLastBarOfSession)" is to make only one print after all bars are loaded.

Comment