Skip to content

ChartTriangle

interface cAlgo.API

DesktopCLICloud

Represents the Triangle 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 ChartTriangle

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

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to draw a triangle on chart with Chart.DrawTriangle method
    public partial class ChartTriangleSample : Indicator
    {
        protected override void Initialize()
        {
            var x1 = Chart.FirstVisibleBarIndex;
            var x2 = Chart.FirstVisibleBarIndex + ((Chart.LastVisibleBarIndex - Chart.FirstVisibleBarIndex) / 2);
            var x3 = Chart.LastVisibleBarIndex;

            var y1 = Bars.LowPrices[x1];
            var y2 = Bars.LowPrices.Minimum(Chart.LastVisibleBarIndex - Chart.FirstVisibleBarIndex);
            var y3 = Bars.HighPrices[x3];

            var triangle = Chart.DrawTriangle("triangle_sample", x1, y1, x2, y2, x3, y3, Color.FromArgb(100, Color.Red), 2, LineStyle.Dots);

            triangle.IsInteractive = true;
            triangle.IsFilled = true;
        }

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

from cAlgo.API import *

class Test():
    def initialize(self):
        x1 = api.Chart.FirstVisibleBarIndex
        x2 = api.Chart.FirstVisibleBarIndex + ((api.Chart.LastVisibleBarIndex - api.Chart.FirstVisibleBarIndex) // 2)
        x3 = api.Chart.LastVisibleBarIndex

        y1 = api.Bars.LowPrices[x1]
        y2 = Functions.Minimum(api.Bars.LowPrices, api.Chart.LastVisibleBarIndex - api.Chart.FirstVisibleBarIndex)
        y3 = api.Bars.HighPrices[x3]

        triangle = api.Chart.DrawTriangle("triangle_sample", x1, y1, x2, y2, x3, y3, Color.FromArgb(100, Color.Red), 2, LineStyle.Dots)
        triangle.IsInteractive = True
        triangle.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.
Time3DesktopCLICloudDateTime Gets or sets the value 3 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.
Y3DesktopCLIClouddouble Gets or sets the value 3 on the Y-axis.

Inherited members

From ChartShape: Thickness, LineStyle, Color, IsFilled

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

See also