Login Page - Create Account

Support Board


Date/Time: Tue, 19 Mar 2024 07:23:32 +0000



Post From: How to use DRAWSTYLE_POINT_VARIABLE_SIZE? Getting strange painting and chart scale.

[2021-04-07 20:19:12]
User719512 - Posts: 225
I have looked at the docs at https://www.sierrachart.com/index.php?page=doc/ChartStudies.html#DrawStyle_PointVariableSize, and getting unexpected results. Is there an example for DRAWSTYLE_POINT_VARIABLE_SIZE, or does anyone have suggestions on how I am using this DrawStyle incorrectly? Example code below. I expected a variable sized point at the sc.Close/Last price. What I am seeing is points at F.US.EPM21 prices like 4072.200, 4072.400 and not 4072.25, 4072.50, etc.



SCSFExport scsf_OSC_TestVariablePoint(SCStudyInterfaceRef sc)
{
SCSubgraphRef Subgraph_VariableVolume = sc.Subgraph[0];

if (sc.SetDefaults)
{
sc.GraphName = "Variable Points";
sc.StudyDescription = "Variable Sized Points Test";

// sc Control variables
sc.AutoLoop = 1;
sc.DisplayAsMainPriceGraph = 1;

Subgraph_VariableVolume.Name = "Variable Volume Points";
Subgraph_VariableVolume.DrawStyle = DRAWSTYLE_POINT_VARIABLE_SIZE;
Subgraph_VariableVolume.PrimaryColor = RGB(128, 128, 128);

return;
}

// for testing, just generate a random number for the Size.
// just take a remainder of time for size 1-5.
int size = sc.BaseDateTimeIn[sc.Index].GetSecond() % 5 + 1;

Subgraph_VariableVolume[sc.Index] = sc.Close[sc.Index];
Subgraph_VariableVolume.Data[sc.Index] = sc.Close[sc.Index];
Subgraph_VariableVolume.Arrays[0][sc.Index] = size;
}