Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 01:19:53 +0000



Excessive precision with stock prices in ASCIL code

View Count: 489

[2020-12-24 16:26:13]
jwick - Posts: 142
When I try to access stock ohlc data, I am getting excessive amounts of precision. When I print out sc.High, for example on AAPL stocks, I get values such as: 113.179893, 114.364998, 114.949295. I am using the SC data feed. I'm hoping this is something I can solve at the chart settings level without having to perform rounding in my code (since that would involve touching a lot of already existing code).

In my chart settings, price display format is 0.01 and tick size is 0.010000
[2020-12-24 16:43:41]
jwick - Posts: 142
hmm I found this post which seems to address this: Prices incorrect for Open, High, Low Close

However, I have a follow up question. If I am using Volume at price information (sc.VolumeAtPriceForBars->GetVAPElementAtPrice) which references prices as total ticks instead of points, how would you suggest I convert a price value to a total ticks value since sc.High[sc.Index] / sc.TickSize now no longer produces whole integer values (all of my code was built for futures where prices are always divisible by the ticksize and now I'm encountering this issue applying that code to stock prices).
[2020-12-24 17:47:08]
Sierra Chart Engineering - Posts: 104368
You need to use this function to round to the nearest integer:
sc.Round()
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2020-12-24 22:36:32

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account