OutputAttribute
Summary
Sealed Class OutputAttribute
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
| 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
| public LineStyle LineStyle {get; set;}
|
Return Value
LineStyle
Examples
| //...
//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
| public string Name {get;}
|
Return Value
string
Examples
| //...
//The plotted indicator name is Simple Moving Average.
[Output("Simple Moving Average")]
public IndicatorDataSeries SMA { get; set; }
//...
|
Color
Signature
| 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
| public string LineColor {get; set;}
|
Return Value
string
Examples
| //...
//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
| public float Thickness {get; set;}
|
Return Value
float
Examples
| //...
//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
Signature
| public bool IsHistogram {get; set;}
|
Return Value
bool
PlotType
Summary
Plot type.
Remarks
The type of the output plotted on the output panel. Default = Line Supported types are: Line Points Histogram
Signature
| public PlotType PlotType {get; set;}
|
Return Value
PlotType
Examples
IsColorCustomizable
Summary
Sets if Output line color is customizable or not.
Remarks
This property is useful when you are setting line color manually with code via SetLineAppearance method.
Signature
| public bool IsColorCustomizable {get; set;}
|
Return Value
bool