Skip to content

ChartIcon

Summary

Represents the Icon chart object.

Signature

1
public abstract interface ChartIcon

Namespace

cAlgo.API

Properties

Name Description
IconType { get; set; } Gets or sets the type of the icon.
Time { get; set; } Gets or sets the Time value of the icon location.
Y { get; set; } Gets or sets the Y-axis value of the icon location.
Color { get; set; } Gets or sets the color of the icon.

Examples

 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
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample indicator shows how to use Chart.DrawIcon method to draw icons
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public 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)
         {
         }
     }
 }

See Also


Last update: July 1, 2022

Comments