Login Page - Create Account

Support Board


Date/Time: Tue, 14 May 2024 20:50:35 +0000



Post From: Positioning of drawstyle graphics above/below bar

[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;  
}