Clarification on ProtoOAGetTrendbarsReq

Created at 11 Sep 2020, 17: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!
CT

ctid2032775

Joined 03.05.2020

Clarification on ProtoOAGetTrendbarsReq
11 Sep 2020, 17:01


Hi all,

maybe I'm wrong but I see a really strange behavior when sending trend bar requests:

  • It's not possible to request more then about 2 weeks of M1 bars (API reference says 5 weeks)
  • If (toTimestamp - fromTimestamp) is more then the mentioned <2 weeks it just strips everything  "before" the latest possible timestamp from the message

As there is no hasMore field in ProtoOAGetTrendbarsRes it's quite hard to find out if some data is missing.

In addition to that I do not receive any error response in case of "wrong" timestamp ranges!

Not related to this issue but a little bit confusing for me is that ticks are sorted in descending order but trend bars are sorted in ascending order - is there any way to change this behavior?

Also, it seems that several bars are missing - some of those (e. g. every night between 22:54 and 23:05) are also missing in cTrader, others are available in cTrader but missing when requested via Open API!
(the missing bars are available in MT5 with an account at the same broker - therefore I guess it's not a broker issue...)

UPDATE:

I've seen that the same data is missing in the ticks, as well. And, similar data is also missing in MT5 but less then in cTrader and (sometimes) with a few minutes delay (confusing)...

The only noticeably difference between MT5 and cTrader is that in case no trading occured MT5 shows "empty" candles (OPEN=HIGH=LOW=CLOSE) but cTRader skips those candles. But I guess this is the desired functionality!

BR,
Christian


@ctid2032775
Replies

PanagiotisCharalampous
14 Sep 2020, 11:35

Hi Christian,

It's not possible to request more then about 2 weeks of M1 bars (API reference says 5 weeks)

There is a hard limit of 14000 bars. We will update the documentation to reflect this information

 As there is no hasMore field in ProtoOAGetTrendbarsRes it's quite hard to find out if some data is missing.

Based on the time span limit and the hard limit of 14000 bars, you will need to program your application accordingly. If for example you detect that bars have not been received until the datetime you need, you will been to detect the missing timespan and request again.

 Not related to this issue but a little bit confusing for me is that ticks are sorted in descending order but trend bars are sorted in ascending order - is there any way to change this behavior?

No but it should not be hard to sort on your side.

Also, it seems that several bars are missing - some of those (e. g. every night between 22:54 and 23:05) are also missing in cTrader, others are available in cTrader but missing when requested via Open API! 

The API requests should fetch exactly what you see on your cTrader chart. If there are discrepancies between UI and API, please provide more information to reproduce the issue. For discrepancies between platforms, you should contact your broker. 

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous