BarOutputAttribute
class cAlgo.API Since 5.4
DesktopCLICloud
This attribute is used for marking an indicator IndicatorBars property as a bar Output.
Definition
public sealed class BarOutputAttribute : Attribute
Namespace: cAlgo.API · Group: Attributes
Remarks
Marks a IndicatorBars 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 IndicatorBars to be displayed.
Examples
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo;
public partial class BarsOutputSample : Indicator
{
private ExponentialMovingAverage _openEma;
private ExponentialMovingAverage _highEma;
private ExponentialMovingAverage _lowEma;
private ExponentialMovingAverage _closeEma;
protected override void Initialize()
{
_openEma = Indicators.ExponentialMovingAverage(Bars.OpenPrices, EmaPeriods);
_highEma = Indicators.ExponentialMovingAverage(Bars.HighPrices, EmaPeriods);
_lowEma = Indicators.ExponentialMovingAverage(Bars.LowPrices, EmaPeriods);
_closeEma = Indicators.ExponentialMovingAverage(Bars.ClosePrices, EmaPeriods);
}
public override void Calculate(int index)
{
Result[index] = new(
_openEma.Result[index],
_highEma.Result[index],
_lowEma.Result[index],
_closeEma.Result[index],
Convert.ToInt64(Bars.TickVolumes[index]));
}
}
class BarsOutputSample():
def initialize(self):
self.openEma = api.Indicators.ExponentialMovingAverage(api.Bars.OpenPrices, api.EmaPeriods)
self.highEma = api.Indicators.ExponentialMovingAverage(api.Bars.HighPrices, api.EmaPeriods)
self.lowEma = api.Indicators.ExponentialMovingAverage(api.Bars.LowPrices, api.EmaPeriods)
self.closeEma = api.Indicators.ExponentialMovingAverage(api.Bars.ClosePrices, api.EmaPeriods)
def calculate(self, index):
api.Result[index] = OhlcvBar(self.openEma.Result[index], self.highEma.Result[index], self.lowEma.Result[index], self.closeEma.Result[index], int(api.Bars.TickVolumes[index]))
{
"AccessRights": "None",
"IsOverlay": false,
"Parameters": [
{
"Name": "EmaPeriods",
"DisplayName": "EMA Periods",
"Type": "Integer",
"DefaultValue": 9
}
],
"BarOutputs": [
{
"Name": "Result",
"DisplayName": "Main"
}
]
}
Constructors
| Name | Description |
|---|---|
| BarOutputAttributeDesktopCLICloud | Initializes a new instance of the BarOutputAttribute and sets the name. |
Properties
| Name | Description |
|---|---|
AreaChartFillColorDesktopCLICloudstring | Gets or sets the color of the area chart. |
BearFillColorDesktopCLICloudstring | Gets or sets the color of the bear candle fill. |
BearOutlineColorDesktopCLICloudstring | Gets or sets the color of the bear candle or bar outline. |
BullFillColorDesktopCLICloudstring | Gets or sets the color of the bull candle fill. |
BullOutlineColorDesktopCLICloudstring | Gets or sets the color of the bull candle or bar outline. |
ChartTypeDesktopCLICloudChartType | Gets or sets the type of the chart - Bar, Candlesticks, Line or Dots chart. |
DescriptionDesktopCLICloudstring | Gets or sets description for output that will be shown in UI. |
DotChartColorDesktopCLICloudstring | Gets or sets the color of the dot chart. |
IsColorCustomizableDesktopCLICloudbool | Gets or sets if Output line color is customizable or not. |
IsLastValueVisibleInTitleDesktopCLICloudbool | Gets or sets if output last value should be visible or not in instance title (default: true). |
IsVisibleDesktopCLICloudbool | Gets or sets default visibility of output. |
NameDesktopCLICloudstring | The output name |
TickVolumeColorDesktopCLICloudstring | Gets or sets the color of the tick volume bars. |