Login Page - Create Account

Support Board


Date/Time: Fri, 29 Mar 2024 08:03:53 +0000



c_ACSILDepthBars->PriceToTickIndex() Returning Wrong Value

View Count: 476

[2020-01-12 21:24:12]
User41727 - Posts: 124
Following situation:

Last price for the bar was 4.78 at the bid. sc.BaseData[SC_LAST][sc.Index] contains 4.78. If I iterate through the depth data, then TickIndexToPrice() will return 4.78 for the index 478 as expected.

However, if I either pass sc.BaseData[SC_LAST][sc.Index] directly to PriceToTickIndex() or assign the value to an intermediary float and pass that one, the function returns the wrong index 477.

Whatever that function does, does not seem to be entirely correct for all argument values.


Version: 2028
[2020-01-13 02:17:21]
Sierra Chart Engineering - Posts: 104368
This must be some kind of floating-point error issue. Try adding .005 to the value before passing to PriceToTickIndex() .
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
[2020-01-13 15:35:10]
User41727 - Posts: 124
That seems to work in this case, although I have not verified that it does not create issue elsewhere.

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

Login

Login Page - Create Account