Screen/Chart/Display Update timing
Screen/Chart/Display Update timing
11 Jun 2020, 13:34
@panagiotis:
The source.
What i can see is that the chart/display is not updated immediately but only when the tick finishes.
And that Ticks are not processed parallel but in a serial manner skipping the events for ticks when the bot is busy.
My goal is to not wait until the tick-handling has finished but to force the chart to display the drawn text immediately.
using System;
using cAlgo.API;
using cAlgo.API.Requests;
using cAlgo.API.Internals;
namespace cAlgo
{
[Robot(AccessRights = AccessRights.None)]
public class Test5 : Robot
{
protected override void OnStart()
{
Chart.DrawStaticText("X", "Test" , VerticalAlignment.Top, HorizontalAlignment.Center, "FFFFFFFF");
}
bool Done = false;
protected override void OnTick()
{
Print("Tick");
if (Done)
return;
Done = true;
Chart.DrawStaticText("Y", "\nTest2" , VerticalAlignment.Top, HorizontalAlignment.Center, "FFFFFFFF");
DateTime Until = DateTime.Now.AddSeconds(10);
while(DateTime.Now<Until)
System.Threading.Thread.Sleep(1000);
}
}
}
Hope you can help.
Replies
Shares4us
11 Jun 2020, 16:43
RE: I am already using that possibility for several projects.
My question was not about a lengthy task but about how cTrader works under the hood.
I hope you will update the docu on ticks with the serial & skip & chartupdate after the tick has been completely processed.
@Shares4us
PanagiotisCharalampous
11 Jun 2020, 16:56
Hi Ton,
Quoting below your words
My goal is to not wait until the tick-handling has finished but to force the chart to display the drawn text immediately.
Hope you can help.
and this is what I replied to. I helped you achieve your goal.
Best Regards,
Panagiotis
@PanagiotisCharalampous
Shares4us
11 Jun 2020, 17:22
RE:
I hope you will update the docu on ticks with the serial & skip & chartupdate after the tick has been completely processed.
@Shares4us
PanagiotisCharalampous
11 Jun 2020, 14:46
Hi Ton,
This is by design. If you want to execute lengthy tasks better use another thread. See below
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous