What is the best way to handle tick losses?

Created at 09 Oct 2024, 09:49
PR

protraderde

Joined 03.01.2021

What is the best way to handle tick losses?
09 Oct 2024, 09:49


Hi,

Time to time ctrader may loose connectivity or because of network issues, i can loose ticks (i mean i do not receive them). I can see this when i rerun the bot at the end of the day after refreshing the charts. Entry points may change because of candle changes.

I can think renting a VPS close to the servers which i need to get information from broker or ctrader. They told me in the telegram channel that i can this info from the broker, i appreciate that.

Until then, is there a way to refresh/fetch the ticks/candles for the last minute/hours etc. to refresh the data and resume from there for a better result?

Also another question came while writing this :) How can i know in the code that there is a connection issue and/or bars need to reload or reloaded?

Best regards


@protraderde
Replies

PanagiotisCharalampous
09 Oct 2024, 12:12

Hi there,

You can use GetBars() and GetTicks() to retrieve historical price information.

Server.IsConnected should let you know if there is a connection issue or not.

Best regards,

Panagiotis


@PanagiotisCharalampous

protraderde
09 Oct 2024, 12:43

RE: What is the best way to handle tick losses?

Thank you! I will inject into Connected and Disconnected events.

If i call GetBars after a connection, will it get updated versions of existing bars or just load more older bars?

Best


@protraderde

PanagiotisCharalampous
09 Oct 2024, 13:02

RE: RE: What is the best way to handle tick losses?

protraderde said: 

Thank you! I will inject into Connected and Disconnected events.

If i call GetBars after a connection, will it get updated versions of existing bars or just load more older bars?

Best

No it won't, it will just fetch the historical bars for you


@PanagiotisCharalampous