Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 01:44:20 +0000



[Programming Help] - Positioning of drawstyle graphics above/below bar

View Count: 679

[2016-11-29 06:02:15]
billx - Posts: 1
Would like the drawstyle graphic to render a specified distance below or above the bar/candle. Currently it renders on the highest or lowest point on the bar/candle.

Is there a subgraph property that will allow control of this?

code snippet:

sg.DrawZeros = 0; // false
sg.GraphRegion = 0;
    
sg.Subgraph[0].Name = "Color0";
sg.Subgraph[0].DrawStyle = DRAWSTYLE_POINTHIGH;
sg.Subgraph[0].SecondaryColorUsed = 0;
sg.Subgraph[0].LineWidth = 6;
sg.Subgraph[0].PrimaryColor = RGB (0,0,255); //Blue
              
              
sg.Subgraph[1].Name = "Color1";
sg.Subgraph[1].DrawStyle = DRAWSTYLE_POINTLOW;
sg.Subgraph[1].SecondaryColorUsed = 0;
sg.Subgraph[1].LineWidth = 6;
sg.Subgraph[1].PrimaryColor = RGB(0,128,0); //Green
              

sg.AutoLoop = 1;

return;
}
    
// Do data processing
    
// Array references
SCFloatArrayRef High = sg.BaseDataIn[SC_HIGH];
SCFloatArrayRef Low = sg.BaseDataIn[SC_LOW];
SCFloatArrayRef Open = sg.BaseDataIn[SC_OPEN];
SCFloatArrayRef Last = sg.BaseDataIn[SC_LAST];
SCFloatArrayRef Avg = sg.BaseDataIn[SC_OHLC];
SCFloatArrayRef Out0 = sg.Subgraph[0].Data;
SCFloatArrayRef Out1 = sg.Subgraph[1].Data;

{
if ((Open[sg.Index-2] >= Last[sg.Index-2])&&
  Low[sg.Index-1] < Low[sg.Index-2]&&   
Low[sg.Index-1] < Low[sg.Index]&&     
    Last[sg.Index] > Open[sg.Index])  
{
    Out1[sg.Index] = Avg[sg.Index];
    sg.Subgraph[1].DataColor[sg.Index] = sg.Subgraph[1].PrimaryColor;
}
else
    Out1[sg.Index] = 0;  
}
[2016-11-29 18:28:17]
Sierra Chart Engineering - Posts: 104368
You just need to use some other Draw Style than what you are using and set the value you want it displayed at by setting that value into the corresponding element of the Subgraph Data array:
ACSIL Interface Members - sc.Subgraph Array: sc.Subgraph[].Data[] / sc.Subgraph[][]
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2016-11-29 18:28:40

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

Login

Login Page - Create Account