Support Board
Date/Time: Sat, 28 Jun 2025 16:23:03 +0000
Sample Code for sc.GetStudyLineUntilFutureIntersectionByIndex()
View Count: 1146
[2020-10-09 21:16:00] |
User253985 - Posts: 23 |
HI Can you provide some sample code for sc.GetStudyLineUntilFutureIntersectionByIndex() I have scanned all the sample code and there is none for this. Please |
[2020-10-13 11:29:16] |
|
We have this documentation here for that function and we have added some additional documentation to it: ACSIL Interface Members - Functions: sc.GetStudyLineUntilFutureIntersectionByIndex() 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 |
[2020-10-24 12:08:58] |
User253985 - Posts: 23 |
Your rewording of the documentation really helped me Thank You. Is below a programming Error on my behalf or is there a fault with the function? When I Click Chart>>Recalculate the value of Index is added again. int Index = 0; Index = sc.GetNumLinesUntilFutureIntersection(sc.ChartNumber, sc.Input[1].GetStudyID()) -1; sc.SetSheetCellAsDouble(SheetHandle, 5, 1, Index); Example. Index Value is 100 and after clicking Chart>>Recalculate it becomes 200, then 300, then 400 etc.... Why is this? Thanks |
[2020-10-24 19:42:05] |
|
This would indicate the number of lines until future intersection is increasing by 100 each time.
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 |
[2020-10-24 20:03:54] |
Ackin - Posts: 1865 |
Why is this?
Simply ... because the function does not check whether a lineuntilfuture has already been created on the given index in the past (it's ok like this) ... each recalculation duplicates the lineuntilfuture (not visible to the user). This is a matter for the programmer if he uses recalculate to handle this situation.... for example by checking if there is already a lineuntilfuture for this index.
Date Time Of Last Edit: 2020-10-24 20:06:56
|
[2020-10-26 20:41:05] |
User253985 - Posts: 23 |
The code below gives the output as per the attached picture 'Line until Intersection.PNG' when it is recalculated it gives the output of 'Line until Intersection 2.PNG' It doesn't replace upon recalculation it adds to the variable. The Actual Number of Lines Until future Intersection is not increasing. #include "sierrachart.h" SCDLLName("Get Future Intersection Lines") SCSFExport scsf_IntersectionLines(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName = "Reference Study Data"; sc.StudyDescription = "Referencing data from other studies on the chart."; sc.AutoLoop = 0; // low precedence level to ensure other studies are calculated first. sc.CalculationPrecedence = LOW_PREC_LEVEL; sc.Input[1].Name = "Study Reference"; sc.Input[1].SetStudyID(1); return; } // choose spreadsheet to put data on const char* SheetCollectionName = "IntersectionTester"; const char* SheetName = "Intersection"; void* SheetHandle = sc.GetSpreadsheetSheetHandleByName(SheetCollectionName, SheetName, false); sc.SetSheetCellAsString(SheetHandle, 0, 0, "Index"); sc.SetSheetCellAsString(SheetHandle, 1, 0, "Line ID For Bar"); sc.SetSheetCellAsString(SheetHandle, 2, 0, "Start Index"); sc.SetSheetCellAsString(SheetHandle, 3, 0, "Line Value"); sc.SetSheetCellAsString(SheetHandle, 4, 0, "Extension Line Chart Column End Index"); sc.SetSheetCellAsString(SheetHandle, 5, 0, "Number of Lines"); int LineIDForBar = 0; int StartIndex = 0; float LineValue = 0; int ExtensionLineChartColumnEndIndex = 0; int Index = 0; Index = sc.GetNumLinesUntilFutureIntersection(sc.ChartNumber, sc.Input[1].GetStudyID()) - 1; sc.SetSheetCellAsDouble(SheetHandle, 5, 1, Index); for (Index; Index >= 0; Index--) { sc.GetStudyLineUntilFutureIntersectionByIndex(sc.ChartNumber, sc.Input[1].GetStudyID(), Index, LineIDForBar, StartIndex, LineValue, ExtensionLineChartColumnEndIndex); // Set labels in Row 1. {SheetHandle, Column, Row, Value} sc.SetSheetCellAsDouble(SheetHandle, 0, Index + 1, Index); sc.SetSheetCellAsDouble(SheetHandle, 1, Index + 1, LineIDForBar); sc.SetSheetCellAsDouble(SheetHandle, 2, Index + 1, StartIndex); sc.SetSheetCellAsDouble(SheetHandle, 3, Index + 1, LineValue); sc.SetSheetCellAsDouble(SheetHandle, 4, Index + 1, ExtensionLineChartColumnEndIndex); } } Date Time Of Last Edit: 2020-10-26 20:43:02
|
![]() ![]() |
[2021-08-25 18:38:11] |
User253985 - Posts: 23 |
I've still not solved this problem, I've been trying a while now.
|
To post a message in this thread, you need to log in with your Sierra Chart account: