API Drawing styles constants: Difference between revisions

From NakedMarkets
Jump to navigation Jump to search
No edit summary
No edit summary
Line 25: Line 25:
C# code snippet :
C# code snippet :
<code>
<code>
        public override void OnInit()
public override void OnInit()
        {
{
            SetIndicatorShortName("Bollinger Bands");
SetIndicatorShortName("Bollinger Bands");
            Indicator_Separate_Window = false;
Indicator_Separate_Window = false;
            SetIndexBuffer(0, UpBand);
SetIndexBuffer(0, UpBand);
            SetIndexStyle(0, DrawingStyle.DRAW_LINE, Color.DarkOrange);
SetIndexStyle(0, DrawingStyle.DRAW_LINE, Color.DarkOrange);
            SetIndexLabel(0, "Up Band");
SetIndexLabel(0, "Up Band");
            SetIndexBuffer(1, MA);
SetIndexBuffer(1, MA);
            SetIndexStyle(1, DrawingStyle.DRAW_LINE, Color.DarkOrange);
SetIndexStyle(1, DrawingStyle.DRAW_LINE, Color.DarkOrange);
            SetIndexLabel(1, "MA");
SetIndexLabel(1, "MA");
            SetIndexBuffer(2, DownBand);
SetIndexBuffer(2, DownBand);
            SetIndexStyle(2, DrawingStyle.DRAW_LINE, Color.DarkOrange);
SetIndexStyle(2, DrawingStyle.DRAW_LINE, Color.DarkOrange);
            SetIndexLabel(2, "Down Band");
SetIndexLabel(2, "Down Band");
        }</code>
}
</code>

Revision as of 11:17, 5 January 2023

Summary

The Drawing style constants are used in chart drawing functions to set the graph type. Is used with the SetIndexStyle() function.

Definition

Constant name Value
DrawingStyle.DRAW_LINE Draws the data as a line
DrawingStyle.DRAW_HISTOGRAM Draws the data as an histogram
DrawingStyle.DRAW_FILL Draws the data as a filled area
DrawingStyle.DRAW_ARROW Draws the data as a symbol
DrawingStyle.DRAW_SECTION Draws the data as sections between even and odd indicator buffers, 2 buffers of values (ie: ZigZag indicator)
DrawingStyle.DRAW_CANDLES Draws the data as a set of candles (ie: Heikin Ashi)
DrawingStyle.DRAW_NONE Doesn't draw the data

Examples

C# code snippet : public override void OnInit() { SetIndicatorShortName("Bollinger Bands"); Indicator_Separate_Window = false; SetIndexBuffer(0, UpBand); SetIndexStyle(0, DrawingStyle.DRAW_LINE, Color.DarkOrange); SetIndexLabel(0, "Up Band"); SetIndexBuffer(1, MA); SetIndexStyle(1, DrawingStyle.DRAW_LINE, Color.DarkOrange); SetIndexLabel(1, "MA"); SetIndexBuffer(2, DownBand); SetIndexStyle(2, DrawingStyle.DRAW_LINE, Color.DarkOrange); SetIndexLabel(2, "Down Band"); }