BarOutputAttribute Summary This attribute is used for marking an indicator IndicatorBars property as a bar Output.
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 bedisplayed.
Signature
public sealed class BarOutputAttribute : Attribute
Namespace cAlgo.API
Examples Example 1 (C#) Example 2 (PYTHON)
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
28
29
30
31
32 using System ;
using cAlgo.API ;
using cAlgo.API.Indicators ;
namespace cAlgo ;
[Indicator(AccessRights = AccessRights.None, IsOverlay = false)]
public class BarsOutputSample : Indicator
{
private ExponentialMovingAverage _openEma ;
private ExponentialMovingAverage _highEma ;
private ExponentialMovingAverage _lowEma ;
private ExponentialMovingAverage _closeEma ;
[Parameter("EMA Periods", DefaultValue = 9)]
public int EmaPeriods { get ; set ; }
[BarOutput("Main")]
public IndicatorBars Result { get ; set ; }
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 ]));
}
}
1
2
3
4
5
6
7
8
9
10
11
12 import clr
clr . AddReference ( "cAlgo.API" )
from cAlgo.API import *
# EmaPeriods is defined as a Parameter and Result is defined as a Bars output in indicator class C# file
class Test ():
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 ]))
See Also Properties Name Summary
The output name
Signature
public string Name { get ;}
Return Value
string
ChartType Summary
Gets or sets the type of the chart - Bar, Candlesticks, Line or Dots chart.
Signature
public ChartType ChartType { get ; set ;}
Return Value
ChartType
BullOutlineColor Summary
Gets or sets the color of the bull candle or bar outline.
Signature
public string BullOutlineColor { get ; set ;}
Return Value
string
BearOutlineColor Summary
Gets or sets the color of the bear candle or bar outline.
Signature
public string BearOutlineColor { get ; set ;}
Return Value
string
BullFillColor Summary
Gets or sets the color of the bull candle fill.
Signature
public string BullFillColor { get ; set ;}
Return Value
string
BearFillColor Summary
Gets or sets the color of the bear candle fill.
Signature
public string BearFillColor { get ; set ;}
Return Value
string
TickVolumeColor Summary
Gets or sets the color of the tick volume bars.
Signature
public string TickVolumeColor { get ; set ;}
Return Value
string
AreaChartFillColor Summary
Gets or sets the color of the area chart.
Signature
public string AreaChartFillColor { get ; set ;}
Return Value
string
DotChartColor Summary
Gets or sets the color of the dot chart.
Signature
public string DotChartColor { get ; set ;}
Return Value
string
IsColorCustomizable Summary
Gets or sets if Output line color is customizable or not.
Remarks
This property is useful when you are setting color manually with code via SetBarAppearance method.
Signature
public bool IsColorCustomizable { get ; set ;}
Return Value
bool
IsLastValueVisibleInTitle Summary
Gets or sets if output last value should be visible or not in instance title (default: true).
Signature
public bool IsLastValueVisibleInTitle { get ; set ;}
Return Value
bool
Description Summary
Gets or sets description for output that will be shown in UI.
Signature
public string Description { get ; set ;}
Return Value
string