ChartEllipse
Summary
Represent the Ellipse chart object.
Signature
| public abstract interface ChartEllipse
|
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 indicator draw an ellipse on chart
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public 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;
}
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13 | 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
|
See Also
Properties
Time1
Summary
Gets or sets the value 1 on the Time line.
Signature
| public abstract DateTime Time1 {get; set;}
|
Return Value
DateTime
Time2
Summary
Gets or sets the value 2 on the Time line.
Signature
| public abstract DateTime Time2 {get; set;}
|
Return Value
DateTime
Y1
Summary
Gets or sets the value 1 on the Y-axis.
Signature
| public abstract double Y1 {get; set;}
|
Return Value
double
Y2
Summary
Gets or sets the value 2 on the Y-axis.
Signature
| public abstract double Y2 {get; set;}
|
Return Value
double