Support Board
Date/Time: Sun, 22 Dec 2024 23:24:59 +0000
Post From: sc.GetStudyArrayFromChartUsingID not working correctly?
[2015-05-01 17:50:20] |
CustomIndicators - Posts: 126 |
I'm trying to use this code in order to retrieve data from a special indicator I made. void sc.GetStudyArrayFromChartUsingID(int ChartNumber, int StudyID , int SubgraphIndex, SCFloatArrayRef SubgraphArray)
So far, I haven't been able to pull anything other than price graph values. The chart I'm trying to pull from for this test, is #1. The StudyID looks to also be 1. In the Chart Studies popup, the list has one study on it, labeled: "1: Indicator. ID: 1" Am I miss-understanding the subgraph index? The indicator is in the code: SCSubgraphRef Indicator = sc.Subgraph[0];
Now, this is what I'm using, trying to grab the value from that indicator: SCFloatArray StudyReference; sc.GetStudyArrayFromChartUsingID(1, 1, 0, StudyReference); float valuE; valuE = StudyReference[0]; SCString BufferOne; BufferOne.Format("Value: %f", valuE); sc.AddMessageToLog(BufferOne, 0); This puts out to the Message Log: Chart: AUDJPY 5 Sec #1 | Study: Indicator | Value: 0.000000 | 2015-05-01 17:47:24 If I have: SCFloatArray StudyReference; sc.GetStudyArrayFromChartUsingID(1, 1, 1, StudyReference); float valuE; valuE = StudyReference[0]; SCString BufferOne; BufferOne.Format("Value: %f", valuE); sc.AddMessageToLog(BufferOne, 0); I get: Chart: AUDJPY 5 Sec #1 | Study: Indicator | Value: 94.593498 | 2015-05-01 17:48:35 How can I get my indicator value? It tends to sit right around the 1.000 to -1.000 range. |