Category Other  Published on 04/03/2016

Time Range Highlighter

Description

Are you curious if the market moves are particular way at 12:35 every day?   Use this time frame highlighter to underline that time range and scan the charts to see if you can find a pattern.

 


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TimeRangeHighlighter : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public int StartMinutes { get; set; }

        [Parameter(DefaultValue = 60)]
        public int EndMinutes { get; set; }

        [Parameter(DefaultValue = 50)]
        public int HistogramHeight { get; set; }



        [Output("Shading", PlotType = PlotType.Histogram, Thickness = 2, Color = Colors.Aqua)]
        public IndicatorDataSeries Result { get; set; }


        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = ...
            var time = this.MarketSeries.OpenTime[index];
            var today = new DateTime(time.Year, time.Month, time.Day);
            var diff = time.Subtract(today).TotalMinutes;
            if (diff >= StartMinutes && diff < EndMinutes)
            {
                Result[index] = this.MarketSeries.Low[index] + HistogramHeight * Symbol.PipSize;
            }

        }
    }
}


PE
pennyfx

Joined on 27.09.2012

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: CarbonFx.TimeRangeHighlighter.algo
  • Rating: 5
  • Installs: 3563
Comments
Log in to add a comment.
ChasBrownTH's avatar
ChasBrownTH · 7 years ago

Thanks, 'pennyfx'. It graphically reminds me to pay attention at key times of the day.

I needed to reduce the 'HistogramHeight' setting, or my 1m charts got flattened. ;)