Skip to main content

Heikin-Ashi chart

info

Charts are available with Avalonia Pro.

Heikin-Ashi charts are a variation of Japanese candlestick charts. They use a modified formula for open, high, low, and close values to filter out market noise and show smoothed trend direction.

Heikin-Ashi chart with smoothed candlesticks using averaged OHLC values to show market trend direction.

When to use

  • Trend identification: Finding the beginning and end of a market trend with less volatility.
  • Swing trading: Identifying pullbacks and reversals in volatile markets.
  • Long-term analysis: Smoothing out day-to-day price fluctuations for a broader view.

Code example

XAML

<charts:HeikinAshiChart Name="HeikinAshiChartSample" Title="Smoothed Price Trend" Height="300"
ItemsSource="{Binding HeikinAshiData}"
HighPath="High" LowPath="Low"
OpenPath="Open" ClosePath="Close"
DatePath="Date" />

Data model (C#)

using System;

public record FinancialPoint(DateTime Date, double Open, double High, double Low, double Close);

public ObservableCollection<FinancialPoint> HeikinAshiData { get; } = new(GenerateFinancialData(40));

private static IEnumerable<FinancialPoint> GenerateFinancialData(int count)
{
var date = DateTime.Today.AddDays(-count);
var price = 100.0;
var random = new Random(42);

for (var i = 0; i < count; i++)
{
var open = price;
var close = open + (random.NextDouble() - 0.5) * 5;
var high = Math.Max(open, close) + random.NextDouble() * 2;
var low = Math.Min(open, close) - random.NextDouble() * 2;

yield return new FinancialPoint(date.AddDays(i), open, high, low, close);
price = close;
}
}

Common properties

PropertyDescriptionDefault
ItemsSourceThe data source of price data.null
OpenPathPaths of the opening price.null
ClosePathPath of the closing price.null
HighPathPath of the highest price.null
LowPathPath of the lowest price.null
DatePathPath of the date or time value associated with each item.null
BullishBrushColor for bullish candles.0x4C, 0xAF, 0x50 (Green)
BearishBrushColor for bearish candles.0xF4, 0x43, 0x36 (Red)
CandleWidthWidth of candles as a proportion of the available slot width, from 0 to 1.0.7