Support Board
Date/Time: Fri, 09 May 2025 22:09:42 +0000
source code
View Count: 45
[2025-05-08 20:39:20] |
User887126 - Posts: 88 |
Hi SC team, Is there a source code available for correlation coefficient study? i have many data input that i am checking and want to plot it all easily on one region. if not, what will be the easiest way to do it? please advise. |
[2025-05-09 02:15:11] |
cmet - Posts: 691 |
This is the function. SCSFExport scsf_CorrelationCoefficient(SCStudyInterfaceRef sc)
{ SCSubgraphRef Subgraph_CorrelationCoefficient = sc.Subgraph[0]; SCInputRef Input_Array1 = sc.Input[0]; SCInputRef Input_Array2 = sc.Input[1]; SCInputRef Input_Length = sc.Input[2]; if(sc.SetDefaults) { sc.GraphName = "Correlation Coefficient"; sc.GraphRegion = 1; Subgraph_CorrelationCoefficient.Name = "CC"; Subgraph_CorrelationCoefficient.DrawStyle = DRAWSTYLE_LINE; Subgraph_CorrelationCoefficient.PrimaryColor = RGB(0,255,0); Subgraph_CorrelationCoefficient.DrawZeros = true; Input_Array1.Name = "Input Array 1"; Input_Array1.SetStudySubgraphValues(0,0); Input_Array2.Name = "Input Array 2"; Input_Array2.SetStudySubgraphValues(0,0); Input_Length.Name = "Length"; Input_Length.SetInt(200); sc.AutoLoop = 1; sc.CalculationPrecedence = LOW_PREC_LEVEL; return; } sc.DataStartIndex = Input_Length.GetInt(); SCFloatArray Array1; SCFloatArray Array2; sc.GetStudyArrayUsingID(Input_Array1.GetStudyID(), Input_Array1.GetSubgraphIndex(), Array1); if(Array1.GetArraySize() < sc.ArraySize) return; sc.GetStudyArrayUsingID(Input_Array2.GetStudyID(), Input_Array2.GetSubgraphIndex(), Array2); if(Array2.GetArraySize() < sc.ArraySize) return; Subgraph_CorrelationCoefficient[sc.Index] = sc.GetCorrelationCoefficient(Array1, Array2, Input_Length.GetInt()); } |
To post a message in this thread, you need to log in with your Sierra Chart account: