Support Board
Date/Time: Tue, 16 Sep 2025 22:12:56 +0000
Post From: Some studies return wrong values when trying to access their subgraph(s)
[2022-12-02 19:18:06] |
ThePeeKay - Posts: 7 |
Hello, I've been hitting a weird issue and I'm trying to understand if this is me doing something wrong or something is not supported in these studies. I'm building a custom study and I'm trying to get values from either studies and their subgraphs so I can make an automated trade. Some studies are not returning the correct values or they seem to return them as part of the wrong subgraph. E.g. // The defaults that might be helpful for your debugging.: sc.UpdateAlways = 1; sc.AutoLoop = 1; sc.GraphRegion = 0; sc.CalculationPrecedence = LOW_PREC_LEVEL; sc.SupportAttachedOrdersForTrading = true; sc.MaximumPositionAllowed = 1; sc.SupportReversals = true; sc.SendOrdersToTradeService = false; sc.AllowOnlyOneTradePerBar = false; sc.MaintainTradeStatisticsAndTradesData = true; // Some examples on how I reference the studies that don't work i_VVAYVAH.Name = "Volume Value Areas YVAH Reference ID"; i_VVAYVAH.SetStudySubgraphValues(15, 1); i_VVAYVAL.Name = "Volume Value Areas YVAL Reference ID"; i_VVAYVAL.SetStudySubgraphValues(15, 2); i_VVAYVPOC.Name = "Volume Value Areas YVPOC Reference ID"; i_VVAYVPOC.SetStudySubgraphValues(15, 0); i_IBH.Name = "Initial Balance IBH Reference ID"; i_IBH.SetStudySubgraphValues(2, 6); i_IBH150.Name = "Initial Balance IBH 150% Reference ID"; i_IBH150.SetStudySubgraphValues(2, 5); i_IBH200.Name = "Initial Balance IBH 200% Reference ID"; i_IBH200.SetStudySubgraphValues(2, 4); i_IBL.Name = "Initial Balance IBL Reference ID"; i_IBL.SetStudySubgraphValues(2, 8); i_IBL150.Name = "Initial Balance IBL 150% Reference ID"; i_IBL150.SetStudySubgraphValues(2, 9); i_IBL200.Name = "Initial Balance IBL 200% Reference ID"; i_IBL200.SetStudySubgraphValues(2, 10); // Some examples of how I retrieve the data from the subgraphs. int theIndex = sc.Index; SCString msg; //Volume Value Areas SCFloatArray YVPocData, YVAHData, YVALData; sc.GetStudyArrayUsingID(i_VVAYVPOC.GetStudyID(), i_VVAYVPOC.GetSubgraphIndex(), YVPocData); sc.GetStudyArrayUsingID(i_VVAYVAH.GetStudyID(), i_VVAYVAH.GetSubgraphIndex(), YVAHData); sc.GetStudyArrayUsingID(i_VVAYVAL.GetStudyID(), i_VVAYVAL.GetSubgraphIndex(), YVALData); sc.AddMessageToLog(msg.Format("DEBUG: YVPOC: %f", YVPocData[theIndex]), true); sc.AddMessageToLog(msg.Format("DEBUG: YVAH: %f", YVAHData[theIndex]), true); sc.AddMessageToLog(msg.Format("DEBUG: YVAL: %f", YVALData[theIndex]), true); //Initial Balance and Extensions SCFloatArray IBHData, IBH150Data, IBH200Data; sc.GetStudyArrayUsingID(i_IBH.GetStudyID(), i_IBH.GetSubgraphIndex(), IBHData); sc.GetStudyArrayUsingID(i_IBH150.GetStudyID(), i_IBH150.GetSubgraphIndex(), IBH150Data); sc.GetStudyArrayUsingID(i_IBH200.GetStudyID(), i_IBH200.GetSubgraphIndex(), IBH200Data); sc.AddMessageToLog(msg.Format("DEBUG: IBH: %f", IBHData[theIndex]), true); sc.AddMessageToLog(msg.Format("DEBUG: IBH150: %f", IBH150Data[theIndex]), true); sc.AddMessageToLog(msg.Format("DEBUG: IBH200: %f", IBH200Data[theIndex]), true); This is some code I use. I double checked in the UI as well, the correct Subgraph is selected on the options of my study, however: Instead of having the correct value on IBH, that actually has a value that is basically Yesterday Low (Which I retrieve earlier as well). And then IBH150 (which is supposed to be the 150% extension of the IBH), it has the value of IBH (the one that I would expect IBH to have, not IBH150). Also, IBH200 has the value of IBH150 etc. etc. It's as if the SubgraphIndex, doesn't match to the correct data internally. Another example is any of the Volume Area Study Subgraphs. They are all wrong and also seem to be that their index is "off" by +1. I can see these values correct on my charts, but not in my study, so I'm thoroughly confused on what's going on. Thank you. |