Support Board
Date/Time: Mon, 09 Jun 2025 19:06:46 +0000
[Programming Help] - Some studies return wrong values when trying to access their subgraph(s)
View Count: 591
[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. |
[2022-12-03 00:01:31] |
User183724 - Posts: 194 |
I cant dont see a problem in what you've posted. if you want to post the entire thing, I'll take a look at it
|
[2022-12-03 01:56:23] |
ThePeeKay - Posts: 7 |
I can post a simple example that doesn’t work, but the logic is exactly as you see it so it’s literally just the sdlcc and the main study export. I’m not sure why support put it as a programming help, this really looks like an engineering bug to me. I could be wrong though. |
[2022-12-03 06:31:48] |
ThePeeKay - Posts: 7 |
OK, I did a test here. I removed some of the subgraph references and it's definitely working now. There is either a bug or an internal limitation on how many other studies you can reference like this and it's starts corrupting data? Can someone from Engineering answer this question or look at this behavior?
|
[2022-12-05 15:48:00] |
John - SC Support - Posts: 40306 |
We would need to know the specific studies that you are referencing, but in general the Subgraphs of the Volume by Price and TPO graphs do not actually contain the data within them - the subgraphs are used mostly to set the color and widths of these items. Refer to the following for how to get the underlying data for a profile: ACSIL Interface Members - Functions: sc.GetVolumeAtPriceDataForStudyProfile() For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2022-12-05 16:36:20] |
ThePeeKay - Posts: 7 |
Thanks John. The two above are some that don't work correctly. I will make a list of all of the ones that I used. What doesn't make sense is that after I removed some studies, some of them started working properly. I'll get back to you within the day with more.
|
To post a message in this thread, you need to log in with your Sierra Chart account: