Login Page - Create Account

Support Board


Date/Time: Mon, 03 Mar 2025 10:48:22 +0000



Post From: How do I Show Profiles on Subgraphs?

[2016-03-03 00:00:45]
Yoda - Posts: 106
Thank you very much for the code to a proper range histogram. I have made a few minor modifications to the code and have enclosed it below. There is only one issue that I'm having when I add this study...SC is creating 2 subgraphs below the existing subgraphs. The first subgraph is blank, and then the range subgraph follows immediately below. Any idea why I'm getting the blank subgraph?



#include "sierrachart.h"
// See the following for more info: How do I Show Profiles on Subgraphs?
// Original created by enemyspy with a few subsequent modifications made by Yoda.
// This code is provided on an "As is, Where is" basis for educational purposes only.

SCDLLName("Range_v01b")
SCSFExport scsf_Range(SCStudyGraphRef sc)

{
SCSubgraphRef Range = sc.Subgraph[0];
SCInputRef StudyInput = sc.Input[0];
if (sc.SetDefaults)
{
sc.GraphName = "Range";
sc.FreeDLL = 0;
sc.AutoLoop = 1;
sc.ValueFormat = VALUEFORMAT_INHERITED; // Sets the numeric display format to the same format as set in Chart >> ChartSettings (Yoda)
sc.DisplayStudyInputValues = 0; // 0 to uncheck the Display Input Values box (Yoda)

// sc.UpdateAlways = 1;

Range.Name = "Range";
Range.DrawStyle = DRAWSTYLE_BAR;
Range.PrimaryColor = RGB(0, 255, 0); // Green (color changed by Yoda)
Range.LineWidth = 5; // The higher the #, the thicker the bar (Yoda)
Range.LineLabel = LL_DISPLAY_NAME | LL_NAME_REVERSE_COLORS | LL_NAME_ALIGN_CENTER | LL_NAME_ALIGN_FAR_RIGHT | LL_DISPLAY_VALUE | LL_VALUE_ALIGN_CENTER | LL_VALUE_ALIGN_VALUES_SCALE; // Automatically turns on the labels (Yoda)

return;
}
Range[sc.Index] = sc.High[sc.Index] - sc.Low[sc.Index];
return;

}