Skip to content

OutputAttribute

Summary

Sealed Class OutputAttribute

Remarks

Marks a IndicatorDataSeries property as output to be displayed on the chart or panel below. To make it effective please apply this attribute in front of the declaration of the IndicatorDataSeries to be displayed.

Signature

1
public sealed class OutputAttribute : Attribute

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample shows how to use indicators OuputAttribute
     [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class OutputAttributeSample : Indicator
     {
         [Output("Open", LineColor = "Red", IsHistogram = false, LineStyle = LineStyle.Dots, PlotType = PlotType.Line, Thickness = 2)]
         public IndicatorDataSeries OpenOutput { get; set; }
         [Output("High", LineColor = "Blue", IsHistogram = false, LineStyle = LineStyle.Solid, PlotType = PlotType.Line, Thickness = 2)]
         public IndicatorDataSeries HighOutput { get; set; }
         [Output("Low", LineColor = "Yellow", IsHistogram = false, LineStyle = LineStyle.Lines, PlotType = PlotType.Line, Thickness = 2)]
         public IndicatorDataSeries LowOutput { get; set; }
         [Output("Close", LineColor = "Green", IsHistogram = false, LineStyle = LineStyle.DotsRare, PlotType = PlotType.Line, Thickness = 2)]
         public IndicatorDataSeries CloseOutput { get; set; }
         protected override void Initialize()
         {
         }
         public override void Calculate(int index)
         {
             OpenOutput[index] = Bars.OpenPrices[index];
             HighOutput[index] = Bars.HighPrices[index];
             LowOutput[index] = Bars.LowPrices[index];
             CloseOutput[index] = Bars.ClosePrices[index];
         }
     }
 }

Properties

LineStyle

Summary

Gets or sets the Line Style for given Output property. By default it is set to Solid

Remarks

If PlotType = PlotType.Line (default) the LineStyle can be added. Supported line styles are: Dots DotsRare DotsVeryRare Lines LinesDots Solid

Signature

1
public LineStyle LineStyle {get; set;}

Return Value

LineStyle

Examples

1
2
3
4
5
 //...
 //Simple moving average will be now plotted as Lines.
 [Output("Simple Moving Average", LineStyle = LineStyle.Lines)]
 public IndicatorDataSeries SMA { get; set; }
 //...

Name

Summary

The plot name

Remarks

Displayed in the User Interface when adding an new instance of the Indicator.

Signature

1
public string Name {get;}

Return Value

string

Examples

1
2
3
4
5
 //...
 //The plotted indicator name is Simple Moving Average.
 [Output("Simple Moving Average")]
 public IndicatorDataSeries SMA { get; set; }
 //...

Color

Signature

1
public Colors Color {get; set;}

Return Value

Colors

LineColor

Summary

Gets or sets the Color of the Output property. This Color will be used when the line for this Output is plotted.

Signature

1
public string LineColor {get; set;}

Return Value

string

Examples

1
2
3
4
5
6
7
8
 //...
 //The result is plotted in Turquoise.
 [Output("Main", LineColor = "#008000")]
 public IndicatorDataSeries SMA { get; set; }
 public override void Calculate(int index)
 {
    //...
 }

Thickness

Summary

Sets the Width of the Output property.

Remarks

This Width will be used when the line for this Output is plotted.

Signature

1
public float Thickness {get; set;}

Return Value

float

Examples

1
2
3
4
5
6
7
8
 //...
 //The result is plotted as a line with thickness level five
 [Output("Simple Moving Average", Thickness = 5)]
 public IndicatorDataSeries SMA { get; set; }
 public override void Calculate(int index)
 {
     //...
 }

Related Tutorials

IsHistogram

Summary

Plots a Histogram.

Signature

1
public bool IsHistogram {get; set;}

Return Value

bool

Examples

1
2
 [Output("Main", IsHistogram = true)]
 public IndicatorDataSeries Result { get; set; }

PlotType

Summary

Plot type.

Remarks

The type of the output plotted on the output panel. Default = Line Supported types are: Line Points Histogram

Signature

1
public PlotType PlotType {get; set;}

Return Value

PlotType

Examples

1
2
3
4
5
6
7
8
 //...
 //The result is plotted as a Histogram.
 [Output("Commodity Channel Index", PlotType = PlotType.Histogram)]
 public IndicatorDataSeries SMA { get; set; }
 public override void Calculate(int index)
 {
     //...
 }
1
2
3
4
5
 //...
 //Plot the result as a set of yellow points.
 [Output("Main", LineColor = "Yellow", PlotType = PlotType.Points)]
 public IndicatorDataSeries Result { get; set; }
 //...