Skip to content

ChartTriangle

Summary

Represents the Triangle chart object.

Signature

1
public abstract interface ChartTriangle

Namespace

cAlgo.API

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
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample shows how to draw a triangle on chart with Chart.DrawTriangle method
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public 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)
         {
         }
     }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 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

See Also

Properties

Time1

Summary

Gets or sets the value 1 on the Time line.

Signature

1
public abstract DateTime Time1 {get; set;}

Return Value

DateTime

Time2

Summary

Gets or sets the value 2 on the Time line.

Signature

1
public abstract DateTime Time2 {get; set;}

Return Value

DateTime

Time3

Summary

Gets or sets the value 3 on the Time line.

Signature

1
public abstract DateTime Time3 {get; set;}

Return Value

DateTime

Y1

Summary

Gets or sets the value 1 on the Y-axis.

Signature

1
public abstract double Y1 {get; set;}

Return Value

double

Y2

Summary

Gets or sets the value 2 on the Y-axis.

Signature

1
public abstract double Y2 {get; set;}

Return Value

double

Y3

Summary

Gets or sets the value 3 on the Y-axis.

Signature

1
public abstract double Y3 {get; set;}

Return Value

double