Calling ProtoOAGetTrendbars - Getting strange values for OHLC

Created at 30 Oct 2023, 09:02
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!
AM

amarilissporto

Joined 28.10.2023

Calling ProtoOAGetTrendbars - Getting strange values for OHLC
30 Oct 2023, 09:02


Hi,

 

Thanks again for the great forum and support.

 

I am having an issue when calling ProtoOAGetTrendbars. The response is fine, however the values returned for the trendbar object are messed up, seems like only the correct value is the low. I am connecting using websockets and using javascript.

Here is my request for NAS100 1 minute bars, 10 length and with a unix timestamp starting today and ending current time:

{
   "payloadType": 2137,
   "payload": {
       "ctidTraderAccountId": XXXXX,
       "period": 1,
       "fromTimestamp": 1698624000000,
       "toTimestamp": 1698656031419,
       "count": 10,
       "symbolId": 10014
   }
}

 

Here is the response:

{
   "ctidTraderAccountId": XXXXX,
   "period": 1,
   "timestamp": 1698655980000,
   "trendbar": [
       {
           "volume": 132,
           "low": 1427670000,
           "deltaOpen": 120000,
           "deltaClose": 20000,
           "deltaHigh": 220000,
           "utcTimestampInMinutes": 28310923
       },
       {
           "volume": 138,
           "low": 1427130000,
           "deltaOpen": 590000,
           "deltaClose": 90000,
           "deltaHigh": 590000,
           "utcTimestampInMinutes": 28310924
       },
       {
           "volume": 120,
           "low": 1427240000,
           "deltaOpen": 20000,
           "deltaClose": 200000,
           "deltaHigh": 340000,
           "utcTimestampInMinutes": 28310925
       },
       {
           "volume": 148,
           "low": 1426990000,
           "deltaOpen": 470000,
           "deltaClose": 30000,
           "deltaHigh": 650000,
           "utcTimestampInMinutes": 28310926
       },
       {
           "volume": 134,
           "low": 1426960000,
           "deltaOpen": 110000,
           "deltaClose": 150000,
           "deltaHigh": 250000,
           "utcTimestampInMinutes": 28310927
       },
       {
           "volume": 106,
           "low": 1427030000,
           "deltaOpen": 130000,
           "deltaClose": 90000,
           "deltaHigh": 180000,
           "utcTimestampInMinutes": 28310928
       },
       {
           "volume": 112,
           "low": 1427130000,
           "deltaOpen": 0,
           "deltaClose": 180000,
           "deltaHigh": 310000,
           "utcTimestampInMinutes": 28310929
       },
       {
           "volume": 120,
           "low": 1427080000,
           "deltaOpen": 250000,
           "deltaClose": 90000,
           "deltaHigh": 250000,
           "utcTimestampInMinutes": 28310930
       },
       {
           "volume": 138,
           "low": 1427220000,
           "deltaOpen": 10000,
           "deltaClose": 350000,
           "deltaHigh": 420000,
           "utcTimestampInMinutes": 28310931
       },
       {
           "volume": 132,
           "low": 1427530000,
           "deltaOpen": 50000,
           "deltaClose": 180000,
           "deltaHigh": 230000,
           "utcTimestampInMinutes": 28310932
       }
   ],
   "symbolId": 10014
}

Am I missing something?

 

Thank you all!


@amarilissporto
Replies

PanagiotisChar
31 Oct 2023, 07:34

Hi there,

The values are fine. They are expressed in delta i.e. the difference from the low price. So high = low + deltaHigh


@PanagiotisChar

amarilissporto
01 Nov 2023, 16:21 ( Updated at: 02 Nov 2023, 06:49 )

RE: Calling ProtoOAGetTrendbars - Getting strange values for OHLC

PanagiotisChar said: 

Hi there,

The values are fine. They are expressed in delta i.e. the difference from the low price. So high = low + deltaHigh

Thank you. I posted the question too soon, after reading the docs I realised that. Thanks for the great support!


@amarilissporto