Login Page - Create Account

Support Board


Date/Time: Thu, 20 Mar 2025 00:06:48 +0000



Post From: ACSIL: sc.AddLineUntilFutureIntersection() delete lines

[2022-10-31 08:59:06]
User431178 - Posts: 617
As requested, here is one possible method. Just add this code at an appropriate point in your study.


// only perform check for intersected line on close of bar
if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED)
{
const int32_t numLines = sc.GetNumLinesUntilFutureIntersection(sc.ChartNumber, sc.StudyGraphInstanceID) - 1;

if (numLines != 0)
{
for (int32_t lineIndex = numLines; lineIndex >= 0; --lineIndex)
{
int32_t lineID{ 0 };
int32_t startIndex{ 0 };
int32_t endIndex{ 0 };
float lineValue{ 0.0f };

if (sc.GetStudyLineUntilFutureIntersectionByIndex(sc.ChartNumber
, sc.StudyGraphInstanceID
, lineIndex
, lineID
, startIndex
, lineValue
, endIndex))
{
if (endIndex > 0)
sc.DeleteLineUntilFutureIntersection(startIndex, lineID);
}
}
}
}

Note, if you are not using autoloop then the line below would need the index value added.

if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED)

Date Time Of Last Edit: 2022-10-31 09:01:17