Market Opening Time Grids v2 free

by leitao.bruno in category Other at 03/04/2021
Description

Shows a grid of market start times.

If you want to change the line color, enter the name of the color in this list.

 

Note:  This script was based on the one created by Summer

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
´╗┐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 MarketOpeningTimeGridsv2 : Indicator
    {
        [Parameter("Frankfurt", DefaultValue = 7, MinValue = 0, MaxValue = 24)]
        public int Frankfurt { get; set; }

        [Parameter("Color Frankfurt", DefaultValue = "Yellow")]
        public string FrankfurtColor { get; set; }

        [Parameter("London", DefaultValue = 8, MinValue = 0, MaxValue = 24)]
        public int London { get; set; }

        [Parameter("Color London", DefaultValue = "Blue")]
        public string LondonColor { get; set; }

        [Parameter("Nova York", DefaultValue = 12, MinValue = 0, MaxValue = 24)]
        public int NY { get; set; }

        [Parameter("Color Nova York", DefaultValue = "Red")]
        public string NYColor { get; set; }

        [Parameter("Sydney", DefaultValue = 21, MinValue = 0, MaxValue = 24)]
        public int Sydney { get; set; }

        [Parameter("Color Sydney", DefaultValue = "Green")]
        public string SydneyColor { get; set; }

        [Parameter("Japan", DefaultValue = 23, MinValue = 0, MaxValue = 24)]
        public int Japan { get; set; }

        [Parameter("Color Japan", DefaultValue = "DarkViolet")]
        public string JapanColor { get; set; }

        protected override void Initialize()
        {

        }

        public override void Calculate(int index)
        {
            var bar = Bars.LastBar;

            if (bar.OpenTime.ToLocalTime().Hour == Frankfurt && bar.OpenTime.ToLocalTime().Minute == 0)
            {
                Chart.DrawVerticalLine("grids" + bar.OpenTime.ToString(), bar.OpenTime, FrankfurtColor, 1, LineStyle.Dots);
            }
            else if (bar.OpenTime.ToLocalTime().Hour == London && bar.OpenTime.ToLocalTime().Minute == 0)
            {
                Chart.DrawVerticalLine("grids" + bar.OpenTime.ToString(), bar.OpenTime, LondonColor, 1, LineStyle.Dots);
            }
            else if (bar.OpenTime.ToLocalTime().Hour == NY && bar.OpenTime.ToLocalTime().Minute == 0)
            {
                Chart.DrawVerticalLine("grids" + bar.OpenTime.ToString(), bar.OpenTime, NYColor, 1, LineStyle.Dots);
            }
            else if (bar.OpenTime.ToLocalTime().Hour == Sydney && bar.OpenTime.ToLocalTime().Minute == 0)
            {
                Chart.DrawVerticalLine("grids" + bar.OpenTime.ToString(), bar.OpenTime, SydneyColor, 1, LineStyle.Dots);
            }
            else if (bar.OpenTime.ToLocalTime().Hour == Japan && bar.OpenTime.ToLocalTime().Minute == 0)
            {
                Chart.DrawVerticalLine("grids" + bar.OpenTime.ToString(), bar.OpenTime, JapanColor, 1, LineStyle.Dots);
            }
        }
    }
}
Comments
0