Login Page - Create Account

Support Board


Date/Time: Mon, 12 May 2025 01:10:01 +0000



How to get absolute value of data and how to use math functions in general in Sierra Chart

View Count: 1545

[2016-03-23 08:04:56]
User972044 - Posts: 154
Hello there,

Can you confirm how to get the absolute value of data. For example I want to get the absolute value of the bar height and currently I am using abs(sc.Open[sc.Index] - sc.Close[sc.Index]) and when I try to output it along with the index value of the bar to debug it, it is NOT working. This is what I am getting from the Message Log:

Chart: AUD.USD-CASH-IDEALPRO 1 Min #1 | Study: Custom DLL Study | Bar height L is: 0.000000 at Index: -1073741824 | 2016-03-23 03:53:00

Why am I getting this gibberish for the Index value when in the code, I specified the index as sc.Index and 0 for the absolute value in the Message line? I inputted "#include <math.h>" and "#include <cmath>" at the beginning of my codes. Is this not correct anymore? If not, can you advise what library files should I have included?

And also I am using other math functions like fmax() and fmin() to process the data as according to the C++ Reference website with the link that you have included in your documentation? Are those still correct?

Please confirm. Thank you for your help.
[2016-03-23 08:32:04]
Sierra Chart Engineering - Posts: 104368
Use:
fabs(sc.Open[sc.Index] - sc.Close[sc.Index])

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

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

Login

Login Page - Create Account