Support Board
Date/Time: Fri, 14 Mar 2025 22:09:18 +0000
Post From: User/Source code controlled settings
[2022-06-28 07:23:12] |
User92573 - Posts: 548 |
Hi, I found this thread really helpful however any thoughts as to why it won't compile correctly for me? #include "sierrachart.h"
#include "scstudyfunctions.h" SCDLLName("ManuallyAndProgrammatically_ChangeDrawStyle_Example") //SCSFExport ManuallyAndProgrammatically_ChangeDrawStyle_Example(SCStudyInterfaceRef sc) SCSFExport ManuallyAndProgrammatically_ChangeDrawStyle_Example(SCStudyGraphRef sc) { SCInputRef should_select_subgraph_drawstyles_manually = sc.Input[0]; SCInputRef should_select_out1_subgraph_drawstyle_manually = sc.Input[1]; SCInputRef select_drawstyle_for_multiple_subgraphs = sc.Input[2]; SCSubgraphRef out1 = sc.Subgraph[0]; SCSubgraphRef out2 = sc.Subgraph[1]; SCSubgraphRef out3 = sc.Subgraph[2]; if (sc.SetDefaults) { sc.GraphName = "Man and Prog Change DrawStyle Example"; sc.GraphRegion = 1; sc.AutoLoop = 1; should_select_subgraph_drawstyles_manually.Name = "Should we select all subgraph drawstyles manually?"; should_select_subgraph_drawstyles_manually.SetYesNo(false); should_select_out1_subgraph_drawstyle_manually.Name = "Should we select out1 drawstyle manually?"; should_select_out1_subgraph_drawstyle_manually.SetYesNo(false); select_drawstyle_for_multiple_subgraphs.Name = "Select a drawstyle to use for multiple subgraphs:"; select_drawstyle_for_multiple_subgraphs.SetCustomInputStrings("Line;Bar;Square"); // IMPORTANT: You can add as many drawstyle names as you want here. For every string you must add a case statement below to set the Drawstyles according to these strings. select_drawstyle_for_multiple_subgraphs.SetCustomInputIndex(1); // This is the index of the selected string drawstyle in the above 0- indexed "array". So entering 0 would select "Line", while 1 selects "Bar". out1.Name = "out1"; out1.PrimaryColor = RGB(0,255,0); out2.Name = "out2"; out2.PrimaryColor = RGB(255,0,0); out3.Name = "out3"; out3.PrimaryColor = RGB(255,255,255); return; } // NOTE: This must be outside of sc.SetDefaults if (!should_select_subgraph_drawstyles_manually.GetYesNo()) { switch (select_drawstyle_for_multiple_subgraphs.GetIndex()) { // IMPORTANT: For every drawstyle string you add above you must add a case where where you actually set the Drawstyles. case 0: // Line if( !should_select_out1_subgraph_drawstyle_manually.GetYesNo() ) out1.DrawStyle = DRAWSTYLE_LINE; out2.DrawStyle = DRAWSTYLE_LINE; out3.DrawStyle = DRAWSTYLE_LINE; // If you had more than a few subgraphs you could use: // for(int subgraph_idx = 0; subgraph_idx < # subgraphs; subgraph_idx++) { // sc.Subgraph[subgraph_idx].DrawStyle = DRAWSTYLE_LINE //} break; case 1: // Bar if( !should_select_out1_subgraph_drawstyle_manually.GetYesNo() ) out1.DrawStyle = DRAWSTYLE_BAR; out2.DrawStyle = DRAWSTYLE_BAR; out3.DrawStyle = DRAWSTYLE_BAR; break; case 2: // SQUARE if( !should_select_out1_subgraph_drawstyle_manually.GetYesNo() ) out1.DrawStyle = DRAWSTYLE_SQUARE; out2.DrawStyle = DRAWSTYLE_SQUARE; out3.DrawStyle = DRAWSTYLE_SQUARE; break; } } // Example outputs out1[sc.Index] = sc.High[sc.Index]; out2[sc.Index] = sc.Low[sc.Index]; out3[sc.Index] = sc.Close[sc.Index]; } // This block is broken but cannot see why? Error is: No study functions present
Many thanks |