Why ChartObjects don`t work in infinite loop?
Created at 09 Aug 2014, 12:58
Why ChartObjects don`t work in infinite loop?
09 Aug 2014, 12:58
Hello all!
I try to create infinite loop in OnTick. For ex.:
double price1 = 1.3340; double price2 = 1.3350; protected override void OnTick() { do { ChartObjects.DrawHorizontalLine("A", price1, Colors.Yellow, 1, LineStyle.Lines); ChartObjects.DrawHorizontalLine("B", price2, Colors.Red, 1, LineStyle.Lines); Thread.Sleep(100); Print(Symbol.Bid); RefreshData(); } while (true); }
And objects dont draw (not displayed on the chart). If i delete do{}while - Bot start work (objects displayed).
What is a the problem ? Thx!
Spotware
11 Aug 2014, 09:02
All chart objects created inside OnTick handler will be displayed on chart only after OnTick handler will be finished. We can recommend you to use OnTimer handler instead of infinite loop.
@Spotware