Skip to content

ChartEllipse

interface cAlgo.API

DesktopCLICloud

Represent the Ellipse 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 ChartEllipse

Namespace: cAlgo.API · Group: Shapes · Implements: ChartShape, ChartObject

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample indicator draw an ellipse on chart
    public partial class ChartEllipseSample : Indicator
    {
        protected override void Initialize()
        {
            Draw();
        }

        public override void Calculate(int index)
        {
            Draw();
        }

        private void Draw()
        {
            var y1 = Bars.HighPrices[Chart.FirstVisibleBarIndex] > Bars.HighPrices[Chart.LastVisibleBarIndex] ? Bars.HighPrices[Chart.FirstVisibleBarIndex] : Bars.HighPrices[Chart.LastVisibleBarIndex];

            var y2 = Bars.LowPrices[Chart.FirstVisibleBarIndex] < Bars.LowPrices[Chart.LastVisibleBarIndex] ? Bars.LowPrices[Chart.FirstVisibleBarIndex] : Bars.LowPrices[Chart.LastVisibleBarIndex];

            var ellipse = Chart.DrawEllipse("ellipse", Chart.FirstVisibleBarIndex, y1, Chart.LastVisibleBarIndex, y2, Color.FromArgb(50, Color.Red.R, Color.Red.G, Color.Red.B));

            ellipse.IsFilled = true;
        }
    }
}
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        self.draw()

    def calculate(self, index):
        self.draw()

    def draw(self):
        y1 = api.Bars.HighPrices[api.Chart.FirstVisibleBarIndex] if api.Bars.HighPrices[api.Chart.FirstVisibleBarIndex] > api.Bars.HighPrices[api.Chart.LastVisibleBarIndex] else api.Bars.HighPrices[api.Chart.LastVisibleBarIndex]
        y2 = api.Bars.LowPrices[api.Chart.FirstVisibleBarIndex] if api.Bars.LowPrices[api.Chart.FirstVisibleBarIndex] < api.Bars.LowPrices[api.Chart.LastVisibleBarIndex] else api.Bars.LowPrices[api.Chart.LastVisibleBarIndex]
        ellipse = api.Chart.DrawEllipse("ellipse", api.Chart.FirstVisibleBarIndex, y1, api.Chart.LastVisibleBarIndex, y2, Color.FromArgb(50, Color.Red.R, Color.Red.G, Color.Red.B))
        ellipse.IsFilled = True
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}

Properties

Name Description
Time1DesktopCLICloudDateTime Gets or sets the value 1 on the Time line.
Time2DesktopCLICloudDateTime Gets or sets the value 2 on the Time line.
Y1DesktopCLIClouddouble Gets or sets the value 1 on the Y-axis.
Y2DesktopCLIClouddouble Gets or sets the value 2 on the Y-axis.

Inherited members

From ChartShape: Thickness, LineStyle, Color, IsFilled

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

See also