Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 23:23:52 +0000



Post From: DRAWING_HORIZONTAL_RAY; Extend Until Future Intersection???

[2023-06-26 00:31:59]
User429065 - Posts: 118
Is there a similar function that adds a "Horizontal Ray Until Future Intersection" to the close of a study (not a bar) that's in a region other than price? I've tried the drawing function below with "ExtendUntilFutureInterection" but am unsuccessful. Thank you for any suggestions!

tool.DrawingType = DRAWING_HORIZONTAL_RAY;



SEE THE REST OF MY CODE BELOW:

#include "sierrachart.h"

SCDLLName("TrendeX_Naked_Closes")

SCSFExport scsf_TrendeX_Naked_Closes(SCStudyInterfaceRef sc)
{
SCInputRef Input_StudySubgraph = sc.Input[0];

if (sc.SetDefaults)
{
// Set the configuration and defaults.

sc.GraphName = "TrendeX Naked Closes";
sc.StudyDescription = "Plots a horizontal ray line at swing high and swing low pivots.";

Input_StudySubgraph.Name = "Input Study and Subgraph";
Input_StudySubgraph.SetStudySubgraphValues(1, 0); // Defaults to study 1, subgraph 0

sc.AutoLoop = 1;
sc.GraphRegion = 1;
sc.ValueFormat = VALUEFORMAT_INHERITED;

return;
}

SCFloatArray StudySubgraphArray;
sc.GetStudyArrayUsingID(Input_StudySubgraph.GetStudyID(), Input_StudySubgraph.GetSubgraphIndex(), StudySubgraphArray);

for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; ++Index)
{
if(Index < 2) continue; // Skip the first two bars

// High pivot (3-bar reversal to the upside)
if (StudySubgraphArray[Index - 1] > StudySubgraphArray[Index - 2] &&
StudySubgraphArray[Index - 1] > StudySubgraphArray[Index])
{
s_UseTool tool;
tool.Clear();
tool.ChartNumber = sc.ChartNumber;
tool.DrawingType = DRAWING_HORIZONTAL_RAY;
tool.BeginIndex = Index - 1;
tool.BeginValue = StudySubgraphArray[Index - 1];
tool.Region = sc.GraphRegion;
tool.Color = RGB(0, 255, 0); // Green
tool.LineWidth = 2;
tool.AddMethod = UTAM_ADD_ALWAYS;
tool.ExtendUntilFutureIntersection = 1;
sc.UseTool(tool);
}

// Low pivot (3-bar reversal to the downside)
if (StudySubgraphArray[Index - 1] < StudySubgraphArray[Index - 2] &&
StudySubgraphArray[Index - 1] < StudySubgraphArray[Index])
{
s_UseTool tool;
tool.Clear();
tool.ChartNumber = sc.ChartNumber;
tool.DrawingType = DRAWING_HORIZONTAL_RAY;
tool.BeginIndex = Index - 1;
tool.BeginValue = StudySubgraphArray[Index - 1];
tool.Region = sc.GraphRegion;
tool.Color = RGB(255, 0, 0); // Red
tool.LineWidth = 2;
tool.AddMethod = UTAM_ADD_ALWAYS;
tool.ExtendUntilFutureIntersection = 1;
sc.UseTool(tool);
}
}
}