Support Board
Date/Time: Tue, 26 Nov 2024 19:46:27 +0000
[User Discussion] - GetStudyArrayFromChart doesn't work ?
View Count: 284
[2023-11-04 19:34:24] |
stephane1 - Posts: 111 |
Hi there, I am trying to recover the value of the ATR on a daily chart and use it on a DOM chart study. This program does not work, it returns me the value 0... it's curious but I can only recover the values d of the study applied to the DOM... however I think that the function used allowed the values to be used on other charts and studies. #include "sierrachart.h"
SCDLLName("TestSizeCalculatorOrder") SCSFExport scsf_TestAdjustPositionSizeByATR(SCStudyInterfaceRef sc) { // loggin object SCString msg; // inputs SCInputRef i_ATR=sc.Input[0]; if (sc.SetDefaults) { sc.GraphName= "Size calculator Order by ATR"; sc.GraphRegion=1; i_ATR.Name="Selectionne ATR study"; i_ATR.SetChartStudySubgraphValues(1,1,0); return; } // Declare variable to hold the array of values from the study SCFloatArray ATRRef ; // pass these in by reference to populate these array with study values sc.GetStudyArrayFromChartUsingID(i_ATR.GetChartStudySubgraphValues(),ATRRef); if (sc.Index==sc.ArraySize-1){ //msg.Format("ATR=%f,Max loss=%f,Adjused Position Size=%d, Account=%f",atrValue,maxLoss,adjustedPositionSize, AccountValue); msg.Format("ATR=%f",ATRRef[sc.Index]); sc.AddMessageToLog(msg, 1); } } |
[2023-11-05 14:54:37] |
User431178 - Posts: 543 |
You would need to use a different index value when accessing the ATR data, as the two arrays are most likely not the same size. Here is some information with example of how to get the required index value - Referencing Other Time Frames and Symbols When Using the ACSIL |
To post a message in this thread, you need to log in with your Sierra Chart account: