Jump to content
Sign in to follow this  

Diff Between Bar History & Trading View Candlestick

Recommended Posts

So, apologies in advance if this has been asked previously, I did attempt to search the forum first.

In pulling price bars by day and attempting to calculate SMA and EMA for myself, I noticed that there seems to be a slight discrepancy between what is showing as the open and close prices of the bars versus what shows when highlighting a candlestick for the same day in the trading view.

As an example, for last Friday, July 17th, 2020, the API returns the following data:

{ BarDate: '/Date(1594944000000)/',
  Open: 1.13837,
  High: 1.14437,
  Low: 1.13776,
  Close: 1.14276 }

However, in viewing the candlestick data, this is what is displayed:

O 1.13824  H 1.14430  L 1.13755  C 1.14261


My guess would be that one or the other is factoring in the spread somehow, but I can't find any documentation to corroborate that. Plus, the diff between the various data points is not consistent across the board. Any help?

Share this post

Link to post

As a quick follow-up, it does look like the API returned price matches when using the Web Trader. I apologize for the noobish question, but what's the difference?

Share this post

Link to post


The "PriceType" parameter used in the API price history calls enables users to select between the ASK / BID / MID price for a market. Since I cannot see which value was used in the API call I can only guess that it was a different one than what the charts are plotting.

The charts on the trading platforms also enable users to select between price types. Please check that the same price type is used on the charts and in the API call. As the differences between the prices are roughly the market spread - I'd guess one is different than the other. :)



Kind Regards, PM


Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this