Login Page - Create Account

Support Board


Date/Time: Thu, 03 Oct 2024 11:34:30 +0000



[Programming Help] - ASCIL: 'optional' Index parameter; sc.AutoLoop

View Count: 43

[2024-10-02 02:09:51]
User379249 - Posts: 2
Hi,

Trying to make a custom Correlation study and using scsf_CorrelationCoefficient as paradigm. That study calls function GetCorrelationCoefficient as found in SCStudyFunctions. I created a similar function to do Kendall Tau correlation through much cut and paste. My scsf_KendallTauCoefficient calls my GetKendallTauCoefficient but my code does not compile ("..too few arguments to function.."). My reading clearly indicates its related to the optional 'int Index' parameter and the sc.AutoLoop = 1 setting. Perhaps I am not enabled to compile such autolooping functions which allow for the use of the Index in the function code block despite not passing the Index in. Flummoxed. I am attaching my .cpp file. (I have function and study in one file)

Thanks in advance for your help.
attachmentpost to SC Support.txt - Attached On 2024-10-02 02:09:05 UTC - Size: 2.74 KB - 39 views
[2024-10-02 08:43:05]
User431178 - Posts: 511
You need to pass in the index parameter, you cannot omit function parameters (unless they are declared with a default value in your declaration/signature).


GetKendallTauCorrelationCoefficient(Array1, Array2, sc.Index, Input_Length.GetInt());

The "indexless" version of scsf_CorrelationCoefficient is an overload with a different signature, it has no index parameter, but instead uses the sc.Index member variable directly.

Take a look in file "sierrachart.h" and you will see what is happening.
[2024-10-02 12:46:55]
User379249 - Posts: 2
Hi,

Thanks for the rapid feedback. It's really appreciated.

The clarification is appreciated. I knew something was clearly wrong but was not sure exactly given the AutoLoop condition.

To be clear, I will pass in the Index parameter. I am not sure how this looks exactly as I am just trying to emulate the CorrelationCoefficient code which does not pass that in.

Also, if I am passing in the variable is the sc.AutoLoop=1 statement still correct and necessary?

I did add the parameter as "(..... , sc.Index, ...)" and kept sc.AutoLoop=1 and the study appears to work just fine. Happy to close this ticket but also happy to receive any comment you might have.

Paul

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

Login

Login Page - Create Account