Support Board
Date/Time: Mon, 25 Nov 2024 13:34:28 +0000
Referencing other charts
View Count: 2917
[2014-01-31 02:08:32] |
vegasfoster - Posts: 444 |
Hi, sorry but I can't make this work to save my life, I am just trying to reference other charts in ASCIL and I can pull from the chart the study is loaded on, but not other charts, and even though I have it set to another chart it shows the studies from the current chart in the drop down list. Please see pic if I am not being clear. Should this code correctly pull from chart 2, study 1, subgraph 1 when loaded on chart 1? SCSFExport scsf_MTFStudyAverageV2(SCStudyInterfaceRef sc) { SCSubgraphRef Average = sc.Subgraph[0]; if (sc.SetDefaults) { sc.GraphName = "MTF Study Average"; sc.FreeDLL = 1; sc.AutoLoop = 1; sc.CalculationPrecedence = LOW_PREC_LEVEL; Average.Name = "Study Average"; Average.DrawStyle = DRAWSTYLE_LINE; Average.LineWidth = 2; Average.PrimaryColor = RGB(0,0,0); sc.Input[0].Name = "Chart Number 1";; sc.Input[0].SetChartNumber(2); sc.Input[1].Name = "Study ID 1"; sc.Input[1].SetStudyID(1); return; } SCGraphData StudyData; sc.GetStudyArraysFromChartUsingID(sc.Input[0].GetChartNumber(), sc.Input[1].GetStudyID(), StudyData); if(StudyData.GetArraySize() == 0) return; SCFloatArrayRef SubgraphArray = StudyData[0]; if(SubgraphArray.GetArraySize() == 0) return; Average[sc.Index] = SubgraphArray[sc.Index]; I have tried code that worked previously and I have tried the current documentation for sc.GetStudyArrayFromChart(), sc.GetStudyArrayFromChartUsingID(), sc.GetStudyArraysFromChart(), and I get the same results regardless of how I do it. Thank you for any help. |
MTF Problem.png / V - Attached On 2014-01-31 02:04:30 UTC - Size: 137.94 KB - 513 views MTFStudyAverageV2.cpp - Attached On 2014-01-31 02:06:23 UTC - Size: 1.04 KB - 603 views MTFStudyAverageV2.dll - Attached On 2014-01-31 02:07:05 UTC - Size: 13.5 KB - 439 views |
[2014-01-31 04:19:17] |
Sierra Chart Engineering - Posts: 104368 |
You are not using the correct input type. You need to use the Study input type which combines both a Chart and a Study as one input. You need to use this: https://www.sierrachart.com/index.php?l=doc/doc_ACSIL_Members_scInputs.html#scInputSetChartStudyValues Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2014-01-31 05:09:48] |
vegasfoster - Posts: 444 |
Thank you! I will give it a go tomorrow.
|
[2014-02-04 22:45:50] |
vegasfoster - Posts: 444 |
Hi, revised the code as indicated, but I am still having same exact problem. I know I am missing something obvious, I just can't figure it. Sorry, thanks again for any help. #include "sierrachart.h" SCDLLName("MTFStudyAverageV2") /*==========================================================================*/ SCSFExport scsf_MTFStudyAverageV2(SCStudyInterfaceRef sc) { SCSubgraphRef Average = sc.Subgraph[0]; if (sc.SetDefaults) { sc.GraphName = "MTF Study Average"; sc.FreeDLL = 1; sc.AutoLoop = 1; sc.CalculationPrecedence = LOW_PREC_LEVEL; Average.Name = "Study Average"; Average.DrawStyle = DRAWSTYLE_LINE; Average.LineWidth = 2; Average.PrimaryColor = RGB(0,0,0); //sc.Input[0].Name = "Chart Number 1";; //sc.Input[0].SetInt(2); //sc.Input[1].Name = "Study ID 1"; //sc.Input[1].SetInt(1); sc.Input[0].SetChartStudyValues(2, 1); return; } int ChartNumber = sc.Input[0].GetChartNumber(); int StudyID = sc.Input[0].GetStudyID(); SCGraphData StudyData; sc.GetStudyArraysFromChartUsingID(ChartNumber, StudyID, StudyData); if(StudyData.GetArraySize() == 0) return; SCFloatArrayRef SubgraphArray = StudyData[0]; if(SubgraphArray.GetArraySize() == 0) return; Average[sc.Index] = SubgraphArray[sc.Index]; } Date Time Of Last Edit: 2014-02-04 22:47:24
|
MTFADX.cht - Attached On 2014-02-04 22:42:59 UTC - Size: 95.67 KB - 458 views MTFStudyAverageV2.cpp - Attached On 2014-02-04 22:47:20 UTC - Size: 1.14 KB - 459 views |
[2014-02-04 22:53:13] |
Sierra Chart Engineering - Posts: 104368 |
A quick look at the code shows that it does look correct. For an example, refer to /ACS_Source/studies7.cpp/scsf_ReferenceDataFromAnotherChart Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2014-02-05 05:53:36] |
vegasfoster - Posts: 444 |
Ok, so I happened to scroll way back on Chart 1 and I can see what is happening now, it is plotting the ADX from Chart 2 bar for bar on Chart 1, it is not matching up the time index and stretching it out, see pic. Should I be doing something with the indexing, or something else, or is this hinky behavior? I looked at the example you referred to and it shows getting the other charts index values, but not using them for purposes of the subgraph plot. Thanks again. |
MTF Problem2.png / V - Attached On 2014-02-05 05:51:24 UTC - Size: 83.56 KB - 471 views |
[2014-02-17 18:44:13] |
vegasfoster - Posts: 444 |
Bump :-) I know I am doing something stupid, but I looked at this again with fresh eyes and still don't see it. Any input would be greatly appreciated. Thanks in advance for any help. |
To post a message in this thread, you need to log in with your Sierra Chart account: