Faster than OnTick()

Created at 20 Jul 2017, 19:01
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
swingfish's avatar

swingfish

Joined 25.06.2016

Faster than OnTick()
20 Jul 2017, 19:01


is there a way to make a timebased loop instead of rely on ticks ? 

sometimes i have the problem that the Symbol the Algo runs is lags on the ticks and the next update have to wait one or 2 secounds .. 

 


@swingfish
Replies

whis.gg
20 Jul 2017, 19:20

You can use Timer. See sample below, the method will be called 10 times per second.

protected override void OnStart()
{
    Timer.Start(TimeSpan.FromMilliseconds(100));
}

protected override void OnTimer()
{
    // put your core logic here
}

 


@whis.gg

swingfish
20 Jul 2017, 20:00

nice and thanks alot

 

for now i just put the onTick in the timer loop .. making it run instantly .. well 100ms instant ;) 

thanks alot.

 

 

       protected override void OnTimer()
        {
            OnTick();
        }
 

 


@swingfish