Skip to content

ChartRectangle

interface cAlgo.API

DesktopCLICloud

Represents the Rectangle chart object. A rectangle of any preferable size and rotation that can be drawn directly in the chart, bound to X-Y axises.

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 ChartRectangle

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

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use Chart.DrawRectangle method to draw a rectangle
    public partial class ChartRectangleSample : Indicator
    {
        protected override void Initialize()
        {
            var period = Chart.LastVisibleBarIndex - Chart.FirstVisibleBarIndex;

            var rectangle = Chart.DrawRectangle("rectangle_sample", Chart.FirstVisibleBarIndex, Bars.LowPrices.Minimum(period), Chart.LastVisibleBarIndex, Bars.HighPrices.Maximum(period), Color.FromArgb(100, Color.Red));

            rectangle.IsFilled = true;
            rectangle.IsInteractive = true;
        }

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

from cAlgo.API import *

class Test():
    def initialize(self):
        period = api.Chart.LastVisibleBarIndex - api.Chart.FirstVisibleBarIndex
        rectangle = api.Chart.DrawRectangle("rectangle_sample", api.Chart.FirstVisibleBarIndex, Functions.Minimum(api.Bars.LowPrices, period), api.Chart.LastVisibleBarIndex, Functions.Maximum(api.Bars.HighPrices, period), Color.FromArgb(100, Color.Red))
        rectangle.IsFilled = True
        rectangle.IsInteractive = 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