Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 02:03:38 +0000



[User Discussion] - Persistent Variables Through Functions for Drawing

View Count: 844

[2015-02-20 23:14:12]
CustomIndicators - Posts: 126
I'm trying to make a function for drawing arrows that I can call, so I can have a bunch of other functions give it specific color/line number/type/position/markertype.

The function I've built so far is:

void DrawArrows(SCStudyGraphRef sc, unsigned int chartNumber, unsigned int id, SCDateTime positionDT, float value, unsigned int type, unsigned int color) {

s_UseTool Tool;
  
Tool.Clear(); // reset tool structure for our next use
Tool.ChartNumber = chartNumber;
Tool.DrawingType = DRAWING_MARKER;
Tool.LineNumber = id;
Tool.BeginDateTime = positionDT;
Tool.BeginValue = value;
Tool.Color = color;
Tool.AddMethod = UTAM_ADD_OR_ADJUST;
Tool.MarkerType = type;
Tool.MarkerSize = 10;
Tool.LineWidth = 2;

sc.UseTool(Tool);
}


And I call it with something like:

DrawArrows(sc, 1, sc.Index, peakOneDT, peakOne, MARKER_ARROWDOWN, COLOR_YELLOW);

I can't seem to figure out how to fix the error:

C:\SierraChart\ACS_Source\My_Indicator.cpp: In function 'void scsf_FRO(SCStudyInterfaceRef)':
C:\SierraChart\ACS_Source\My_Indicator.cpp:95:157: error: a function-definition is not allowed here before '{' token
void DrawArrows(SCStudyGraphRef sc, unsigned int chartNumber, unsigned int id, SCDateTime positionDT, float value, unsigned int type, unsigned int color) {
^
C:\SierraChart\ACS_Source\My_Indicator.cpp:247:84: error: 'DrawArrows' was not declared in this scope
DrawArrows(sc, 1, sc.Index, peakOneDT, peakOne, MARKER_ARROWDOWN, COLOR_YELLOW);
^
-- End of Build -- 16:00:37


I suspect that the problem may lye where I try to put through a persistent variable for the SCDateTime. I know that the persistent variable is working correctly, due to it working in other parts of my code.
Date Time Of Last Edit: 2015-04-04 05:39:08

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account