Skip to content

ChartIcon

interface cAlgo.API

DesktopCLICloud

Represents the Icon chart object.

Environment behaviour

CLI — works differently. Created and kept with all its properties, but never drawn: the CLI displays no chart.

Cloud — works differently. Created and kept with all its properties, but never drawn: the cloud displays no chart.

Definition

public interface ChartIcon

Namespace: cAlgo.API · Group: Drawings · Implements: ChartObject

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample indicator shows how to use Chart.DrawIcon method to draw icons
    public partial class ChartIconSample : Indicator
    {
        protected override void Initialize()
        {
            for (int i = Chart.FirstVisibleBarIndex; i <= Chart.LastVisibleBarIndex; i++)
            {
                var iconName = string.Format("Icon_{0}", i);

                if (Bars.ClosePrices[i] > Bars.OpenPrices[i])
                {
                    Chart.DrawIcon(iconName, ChartIconType.UpArrow, i, Bars.LowPrices[i], Color.Green);
                }
                else
                {
                    Chart.DrawIcon(iconName, ChartIconType.DownArrow, i, Bars.HighPrices[i], Color.Red);
                }
            }
        }

        public override void Calculate(int index)
        {
        }
    }
}
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        for i in range(api.Chart.FirstVisibleBarIndex, api.Chart.LastVisibleBarIndex):
            iconName = f"Icon_{i}"
            if api.Bars.ClosePrices[i] > api.Bars.OpenPrices[i]:
                api.Chart.DrawIcon(iconName, ChartIconType.UpArrow, i, api.Bars.LowPrices[i], Color.Green)
            else:
                api.Chart.DrawIcon(iconName, ChartIconType.DownArrow, i, api.Bars.HighPrices[i], Color.Red)
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}

Properties

Name Description
ColorDesktopCLICloudColor Gets or sets the color of the icon.
IconTypeDesktopCLICloudChartIconType Gets or sets the type of the icon.
TimeDesktopCLICloudDateTime Gets or sets the Time value of the icon location.
YDesktopCLIClouddouble Gets or sets the Y-axis value of the icon location.

Inherited members

From ChartObject: Name, Comment, ObjectType, IsInteractive, IsLocked, IsHidden, ZIndex, IsAlive

See also