Login Page - Create Account

Support Board


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



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

[2023-06-28 20:31:01]
User429065 - Posts: 118
Hey thanks, Brad for the tip!!! As you can see, I've added it to my code below but for some reason, this thing won't compile. Am I missing something here?

The remote build did not succeed. Result:

TrendeX_Naked_Closes.cpp: In function 'void scsf_TrendeX_Naked_Closes(SCStudyInterfaceRef)':
TrendeX_Naked_Closes.cpp:67:84: error: too many arguments to function
67 | if (sc.ChartDrawingExists(sc.ChartNumber, DRAWING_HORIZONTAL_RAY, Index - 1))
| ^

-- End of Build -- 15:26:52


#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;
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;
sc.UseTool(tool);
}

if (sc.ChartDrawingExists(sc.ChartNumber, DRAWING_HORIZONTAL_RAY, Index - 1))
{
s_UseTool tool;
tool.Clear();
tool.ChartNumber = sc.ChartNumber;
tool.DrawingType = DRAWING_HORIZONTAL_LINE_NON_EXTENDED;
tool.BeginIndex = Index - 1;
tool.BeginValue = StudySubgraphArray[Index - 1];
tool.Color = RGB(0, 0, 255); // Blue
tool.LineWidth = 2;
tool.AddMethod = UTAM_ADD_OR_ADJUST;
sc.UseTool(tool);
}
}
}
Date Time Of Last Edit: 2023-06-29 19:09:10