Draw line at each hour

Created at 11 Jan 2017, 01:32
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
XX

xxilim

Joined 11.01.2017

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)
        {
        }
    }
}

 


@xxilim