Login Page - Create Account

Support Board


Date/Time: Fri, 21 Mar 2025 08:13:03 +0000



Docs incorrect - cause a compile error.

View Count: 520

[2022-11-09 16:16:22]
JohnR - User831573 - Posts: 320
Using Drawing Tools From an Advanced Custom Study: s_UseTool::DrawingType

s_UseTool::LineStyle
Type: Integer

The line style for the chart drawing. Available line styles are: LINESTYLE_SOLID, LINESTYLE_DASH, LINESTYLE_DOT, LINESTYLE_DASHDOT, and LINESTYLE_DASHDOTDOT.


When I try to use an int variable to set the tool.LineStyle the compiler throws an error.
1>F:\- John's Personal Stock stuff\Sierra Chart Stuff\JOR_Custom_Studies\JOR_Custom_Studies_Collection\JOR_Custom_Studies_Collection.cpp(2806,49): error C2440: '=': cannot convert from 'int' to 'SubgraphLineStyles'
1>F:\- John's Personal Stock stuff\Sierra Chart Stuff\JOR_Custom_Studies\JOR_Custom_Studies_Collection\JOR_Custom_Studies_Collection.cpp(2806,48): message : Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or parenthesized function-style cast)

even using the drawing object structure I just read and getting the JOR_DrawingObj.LevelStyle[x] throws an error

Only using your enumerations will compile.

DGL_Tool.LineStyle = JOR_LevelStyle[looper];
DGL_Tool.LineStyle = JOR_DrawingObj.LevelStyle[looper];
DGL_Tool.LineStyle = LINESTYLE_SOLID;

definitions above error code
// Set or reset variables used to hold properties of pitchfork
  float JOR_Levels[32] = { FLT_MAX };
  COLORREF JOR_LevelColor[32] = { 0 };
  int JOR_LevelWidth[32] = { 0 };
  int JOR_LevelStyle[32] = { 0 };

  // Get values from drawing object instance
for (int looper = 0; looper < 32; looper++)
  {
  JOR_Levels[looper] = JOR_DrawingObj.RetracementLevels[looper];
  JOR_LevelColor[looper] = JOR_DrawingObj.LevelColor[looper];
  JOR_LevelWidth[looper] = JOR_DrawingObj.LevelWidth[looper];
  JOR_LevelStyle[looper] = JOR_DrawingObj.LevelStyle[looper];

Guidance please
JohnR

Update - I also took a stab a making it an explicit static cast. The compile gave different errors.

SubgraphLineStyles DGL_Tool.LineStyle = static_cast<SubgraphLineStyles>(JOR_LevelStyle[looper]);

Update 2 - I am able to compile - I corrected the static cast line
DGL_Tool.LineStyle = static_cast<SubgraphLineStyles>(JOR_LevelStyle[looper]);
Date Time Of Last Edit: 2022-11-09 16:24:48
[2022-11-11 15:33:52]
Sierra_Chart Engineering - Posts: 18875
We will check on this.
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, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-11-18 15:25:52]
Sierra_Chart Engineering - Posts: 18875
We see you have resolved the problem. So we consider this request closed.
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, use the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account