Support Board
Date/Time: Tue, 26 Nov 2024 19:59:29 +0000
Post From: GetStudyArrayFromChart doesn't work ?
[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); } } |