Skip to content

CandleStickMark

ClassChartGuruChartGuru
public class CandleStickMark : ChartMark, IChartMark, IChartContent

Represents a candlestick mark for financial charts. Composed of:

  • A body (BarMark) showing open-close range
  • A wick (RuleMark) showing high-low range

Usage: var candle = new CandleStickMark( x: 0, open: 100, high: 110, low: 95, close: 105 ); chart.AddMarks(candle.GetMarks());

public CandleStickMark()

CandleStickMark(float, float, float, float, float)

Section titled “CandleStickMark(float, float, float, float, float)”
public CandleStickMark(float x, float open, float high, float low, float close)

Creates one candlestick sample, deriving its body, wick, bullish state, and initial color from OHLC values.

Parameters

Name Type
x System.Single
open System.Single
high System.Single
low System.Single
close System.Single

FromOHLC(float, float, float, float, float)

Section titled “FromOHLC(float, float, float, float, float)”
public static CandleStickMark FromOHLC(float x, float open, float high, float low, float close)

Creates a candlestick from OHLC data.

Parameters

Name Type
x System.Single
open System.Single
high System.Single
low System.Single
close System.Single

Returns

ChartGuru.CandleStickMark

public CandleStickMark Colors(Color bullish, Color bearish)

Sets the bullish and bearish colors.

Parameters

Name Type
bullish UnityEngine.Color
bearish UnityEngine.Color

Returns

ChartGuru.CandleStickMark

public CandleStickMark BodyWidth(float ratio)

Sets the body width ratio.

Parameters

Name Type
ratio System.Single

Returns

ChartGuru.CandleStickMark

public CandleStickMark WickWidth(float width)

Sets the wick line width.

Parameters

Name Type
width System.Single

Returns

ChartGuru.CandleStickMark

public CandleStickMark CornerRadius(float radius)

Sets the corner radius for the body.

Parameters

Name Type
radius System.Single

Returns

ChartGuru.CandleStickMark

public IEnumerable<IChartMark> GetMarks()

Expands the candlestick into its component marks:

  1. A vertical RuleMark for the wick (high-low range)
  2. A range BarMark for the body (open-close range)

Returns

System.Collections.Generic.IEnumerable{ChartGuru.IChartMark}

public BarMark GetBodyMark()

Gets just the body mark for custom rendering.

Returns

ChartGuru.BarMark

public RuleMark GetWickMark()

Gets just the wick mark for custom rendering.

Returns

ChartGuru.RuleMark

public override (Vector2 source, Vector2 target) GetMorphTargets(ChartType targetType, Rect plotArea)

Projects this mark into plot-space geometry that the morph renderer can interpolate toward the requested chart type.

Parameters

Name Type
targetType ChartGuru.ChartType
plotArea UnityEngine.Rect

Returns

System.ValueTuple{UnityEngine.Vector2,UnityEngine.Vector2}

public override IChartMark Clone()

Creates an independent copy of this Candle Stick Mark; later configuration changes do not affect the original instance.

Returns

ChartGuru.IChartMark

public override ChartType MarkType { get; }

Returns

ChartGuru.ChartType

public float X { get; set; }

X Position (typically represents time/date index).

Returns

System.Single

public float Open { get; set; }

Opening price.

Returns

System.Single

public float High { get; set; }

Highest price.

Returns

System.Single

public float Low { get; set; }

Lowest price.

Returns

System.Single

public float Close { get; set; }

Closing price.

Returns

System.Single

public float WickLineWidth { get; set; }

Width of the wick line in pixels.

Returns

System.Single

public float BodyWidthRatio { get; set; }

Width ratio of the body relative to available slot width.

Returns

System.Single

public Color BullishColor { get; set; }

Color for bullish candles (close > open).

Returns

UnityEngine.Color

public Color BearishColor { get; set; }

Returns

UnityEngine.Color

public float CornerRadiusValue { get; set; }

Corner radius for the body.

Returns

System.Single

public bool IsBullish { get; }

Whether this is a bullish candle (close >= open).

Returns

System.Boolean

public Color CurrentColor { get; }

The current color based on bullish/bearish state.

Returns

UnityEngine.Color

public float BodyMin { get; }

Returns

System.Single

public float BodyMax { get; }

Returns

System.Single

public float WickMin { get; }

Returns

System.Single

public float WickMax { get; }

Returns

System.Single