Category Other  Published on 12/03/2021

Daily Price Lines

Description

前日日足の高値・安値・始値・終値のラインを表示します。

Draw the previous day's daily high, low, opening, and closing price lines.

 

 


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 DailyPriceLines : Indicator
    {
        [Parameter("High", DefaultValue = true)]
        public bool High { get; set; }

        [Parameter("Low", DefaultValue = true)]
        public bool Low { get; set; }

        [Parameter("Open", DefaultValue = true)]
        public bool Open { get; set; }

        [Parameter("Close", DefaultValue = true)]
        public bool Close { get; set; }

        [Parameter("High Color", DefaultValue = "Red")]
        public string HighColor { get; set; }

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

        [Parameter("Open Color", DefaultValue = "DeepPink")]
        public string OpenColor { get; set; }

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



        protected override void Initialize()
        {

        }

        public override void Calculate(int index)
        {
            var bars = MarketData.GetBars(TimeFrame.Daily);

            if (High)
                Chart.DrawHorizontalLine("Daily Heigh", bars.HighPrices.Last(1), HighColor, 1, LineStyle.Dots);

            if (Low)
                Chart.DrawHorizontalLine("Daily Low", bars.LowPrices.Last(1), LowColor, 1, LineStyle.Dots);

            if (Open)
                Chart.DrawHorizontalLine("Daily Open", bars.OpenPrices.Last(1), OpenColor, 1, LineStyle.Dots);

            if (Close)
                Chart.DrawHorizontalLine("Daily Close", bars.ClosePrices.Last(1), CloseColor, 1, LineStyle.Dots);
        }
    }
}


summer's avatar
summer

Joined on 10.08.2020

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Daily Price Lines.algo
  • Rating: 5
  • Installs: 2727
  • Modified: 13/10/2021 09:55
Comments
Log in to add a comment.
RY
ryosukeh2100 · 1 year ago

Thank you for the indicator. It's very helpful. Could you please add a possibility to change the style and thickness of the lines?

Thank you. よろしくお願いします。

summer's avatar
summer · 3 years ago

Hey Guys!

Then I updated it.

Try it!

LA
lazarevic.miroslav · 3 years ago

You can customize that easily for yourself. Just replace Color with Color.Blue or whatever name you want and rebuild the indicator.

dokinya's avatar
dokinya · 3 years ago

this indicator is awesome is possible to add color to 

high

low

open

close

?