Draw line at each hour
11 Jan 2017, 01:32
Hello all,
How easy is it to modify this code to display a vertical line on every hour change?
This is the round number indicator, not sure if it's even the right place to start?
using System;
using cAlgo.API;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true)]
public class RoundNumbers : Indicator
{
[Parameter(DefaultValue = 100)]
public int StepPips { get; set; }
protected override void Initialize()
{
double max = MarketSeries.High.Maximum(MarketSeries.High.Count);
double min = MarketSeries.Low.Minimum(MarketSeries.Low.Count);
double step = Symbol.PipSize*StepPips;
double start = Math.Floor(min/step)*step;
for (double level = start; level <= max + step; level += step)
{
ChartObjects.DrawHorizontalLine("line_" + level, level, Colors.Gray);
}
}
public override void Calculate(int index)
{
}
}
}
