CalculateY Method (2)
CalculateY (1 of 2)
Summary
Calculates Y-axis value corresponding the specified bar index.
Signature
| public abstract double CalculateY(int barIndex)
|
Parameters
Name | Type | Description |
barIndex | int | Index of the bar. |
Return Value
double
Declaring Type
cAlgo.API.ChartTrendLine
Examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | using cAlgo.API;
namespace cAlgo
{
// This sample shows how to use Chart.DrawTrendLine to draw a trend line on chart
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class ChartTrendLineSample : Indicator
{
protected override void Initialize()
{
var trendLine = Chart.DrawTrendLine("trendLine", Chart.FirstVisibleBarIndex, Bars.LowPrices[Chart.FirstVisibleBarIndex], Chart.LastVisibleBarIndex, Bars.HighPrices[Chart.LastVisibleBarIndex], Color.Red, 2, LineStyle.Dots);
trendLine.IsInteractive = true;
}
public override void Calculate(int index)
{
}
}
}
|
CalculateY (2 of 2)
Summary
Calculates Y-axis value corresponding the specified time value.
Signature
| public abstract double CalculateY(DateTime time)
|
Parameters
Name | Type | Description |
time | DateTime | The time. |
Return Value
double
Declaring Type
cAlgo.API.ChartTrendLine
Examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | using cAlgo.API;
namespace cAlgo
{
// This sample shows how to use Chart.DrawTrendLine to draw a trend line on chart
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class ChartTrendLineSample : Indicator
{
protected override void Initialize()
{
var trendLine = Chart.DrawTrendLine("trendLine", Chart.FirstVisibleBarIndex, Bars.LowPrices[Chart.FirstVisibleBarIndex], Chart.LastVisibleBarIndex, Bars.HighPrices[Chart.LastVisibleBarIndex], Color.Red, 2, LineStyle.Dots);
trendLine.IsInteractive = true;
}
public override void Calculate(int index)
{
}
}
}
|
Last update: March 23, 2023