Skip to content

IndicatorBars

interface cAlgo.API Since 5.4

DesktopCLICloud

The interface representing an indicator bars that are displayed as an output.

Definition

public interface IndicatorBars

Namespace: cAlgo.API · Group: Data Series

Examples

public partial class HeikinAshiBars : Indicator
{
    public override void Calculate(int index)
    {
        var bar = Bars[index];
        var close = (bar.Open + bar.High + bar.Low + bar.Close) / 4;
        var open = index == 0 ? bar.Open : (Result.OpenPrices[index - 1] + Result.ClosePrices[index - 1]) / 2;
        var high = Math.Max(bar.High, Math.Max(open, close));
        var low = Math.Min(bar.Low, Math.Min(open, close));
        Result[index] = new OhlcvBar(open, high, low, close, bar.TickVolume);
    }
}
def calculate(self, index):
    bar = api.Bars[index]
    closePrice = (bar.Open + bar.High + bar.Low + bar.Close) / 4
    openPrice = bar.Open if index == 0 else (api.Result.OpenPrices[index - 1] + api.Result.ClosePrices[index - 1]) / 2
    highPrice = max(bar.High, openPrice, closePrice)
    lowPrice = min(bar.Low, openPrice, closePrice)
    api.Result[index] = OhlcvBar(openPrice, highPrice, lowPrice, closePrice, bar.TickVolume)
{
  "AccessRights": "None",
  "IsOverlay": false,
  "BarOutputs": [
    {
      "Name": "Result",
      "DisplayName": "Heikin Ashi"
    }
  ]
}

Properties

Name Description
ClosePricesDesktopCLICloudDataSeries Gets the Close price bars data.
CountDesktopCLICloudint Gets the number of bars.
HighPricesDesktopCLICloudDataSeries Gets the High price bars data.
ItemDesktopCLICloudOhlcvBar Gets or sets a bar based on it is index.
LowPricesDesktopCLICloudDataSeries Gets the Low price bars data.
OpenPricesDesktopCLICloudDataSeries Gets the Open price bars data.
OutputDesktopCLICloudIndicatorBarOutput Gets the indicator output.
TickVolumesDesktopCLICloudDataSeries Gets the Tick volumes data.