How to draw vertical line or any mark on bar every one minute on tick chart

Created at 26 Jul 2022, 12:29
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!
MongolTrader's avatar

MongolTrader

Joined 12.02.2015

How to draw vertical line or any mark on bar every one minute on tick chart
26 Jul 2022, 12:29


Please tell me how to draw vertical line or any mark on bar every one minute on tick chart.  


@MongolTrader
Replies

paolo.panicali
28 Jul 2022, 13:04

Minute bar separator on tick chart

 

//Answer #2 to MongolTrader since: 12 Feb 2015  28 Jul 2022, 09:53
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class MongolTrader2 : Indicator
    {
        public override void Calculate(int index)
        {
            var srcPrev = Bars.OpenTimes[index - 1];
            var src = Bars.OpenTimes[index];


            if (srcPrev.Minute == src.AddMinutes(-1).Minute)
            {
                var line1 = Chart.DrawVerticalLine("Line" + index, src.AddMinutes(-1), Color.Red, 2, LineStyle.DotsRare);
            }

        }
    }
}


@paolo.panicali

MongolTrader
29 Jul 2022, 04:56 ( Updated at: 21 Dec 2023, 09:22 )

RE: Minute bar separator on tick chart

paolo.panicali said:

 

//Answer #2 to MongolTrader since: 12 Feb 2015  28 Jul 2022, 09:53
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class MongolTrader2 : Indicator
    {
        public override void Calculate(int index)
        {
            var srcPrev = Bars.OpenTimes[index - 1];
            var src = Bars.OpenTimes[index];


            if (srcPrev.Minute == src.AddMinutes(-1).Minute)
            {
                var line1 = Chart.DrawVerticalLine("Line" + index, src.AddMinutes(-1), Color.Red, 2, LineStyle.DotsRare);
            }

        }
    }
}

Thank you very much bro. May i have friend with telegram or any other social fb instagram etc... Let me know ID if ok


@MongolTrader