More Ticks

Created at 13 Sep 2016, 18:15
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!
ON

one.void

Joined 13.05.2016

More Ticks
13 Sep 2016, 18:15


Please increase the Ticks to include T64, T128, T256, and T512.

Thanks


@one.void
Replies

whis.gg
14 Sep 2016, 04:49

using System;
using cAlgo.API;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CustomTF : Indicator
    {
        [Parameter("Period", DefaultValue = 1, MinValue = 1)]
        public int Period { get; set; }

        [Parameter("Wick Thickness", DefaultValue = 1, MinValue = 1)]
        public int WickThickness { get; set; }
        [Parameter("Body Thickness", DefaultValue = 3, MinValue = 1)]
        public int BodyThickness { get; set; }

        [Parameter("Bullish Color", DefaultValue = "SeaGreen")]
        public string ColorBull { get; set; }
        [Parameter("Bearish Color", DefaultValue = "Tomato")]
        public string ColorBear { get; set; }

        private Colors colorBull, colorBear;

        protected override void Initialize()
        {
            Enum.TryParse<Colors>(ColorBull, out colorBull);
            Enum.TryParse<Colors>(ColorBear, out colorBear);
        }

        public override void Calculate(int index)
        {
            int idx1 = index - (index % (Period));
            int idx2 = idx1 + (index - idx1) / 2;
            int x = idx2 - idx1;

            double open = (MarketSeries.Open[idx1] + MarketSeries.Close[idx1 - 1]) / 2;
            double high = Functions.Maximum(MarketSeries.High, index - idx1 + 1);
            double low = Functions.Minimum(MarketSeries.Low, index - idx1 + 1);
            double close = MarketSeries.Close[index];

            var color = close > open ? colorBull : colorBear;

            ChartObjects.DrawLine("Wick" + idx1, idx2, high, idx2, low, color, WickThickness, LineStyle.Solid);
            ChartObjects.DrawLine("Body" + idx1, idx2, open, idx2, close, color, BodyThickness, LineStyle.Solid);
        }
    }
}

 

This indicator plots chart X times bigger than original. Therefore if you attach it on t34 chart with period of 5, you will get t170 chart.

I hope it helps.


@whis.gg

whis.gg
14 Sep 2016, 04:50

using System;
using cAlgo.API;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CustomTF : Indicator
    {
        [Parameter("Period", DefaultValue = 1, MinValue = 1)]
        public int Period { get; set; }

        [Parameter("Wick Thickness", DefaultValue = 1, MinValue = 1)]
        public int WickThickness { get; set; }
        [Parameter("Body Thickness", DefaultValue = 3, MinValue = 1)]
        public int BodyThickness { get; set; }

        [Parameter("Bullish Color", DefaultValue = "SeaGreen")]
        public string ColorBull { get; set; }
        [Parameter("Bearish Color", DefaultValue = "Tomato")]
        public string ColorBear { get; set; }

        private Colors colorBull, colorBear;

        protected override void Initialize()
        {
            Enum.TryParse<Colors>(ColorBull, out colorBull);
            Enum.TryParse<Colors>(ColorBear, out colorBear);
        }

        public override void Calculate(int index)
        {
            int idx1 = index - (index % (Period));
            int idx2 = idx1 + (index - idx1) / 2;
            int x = idx2 - idx1;

            double open = (MarketSeries.Open[idx1] + MarketSeries.Close[idx1 - 1]) / 2;
            double high = Functions.Maximum(MarketSeries.High, index - idx1 + 1);
            double low = Functions.Minimum(MarketSeries.Low, index - idx1 + 1);
            double close = MarketSeries.Close[index];

            var color = close > open ? colorBull : colorBear;

            ChartObjects.DrawLine("Wick" + idx1, idx2, high, idx2, low, color, WickThickness, LineStyle.Solid);
            ChartObjects.DrawLine("Body" + idx1, idx2, open, idx2, close, color, BodyThickness, LineStyle.Solid);
        }
    }
}

 


@whis.gg

one.void
15 Sep 2016, 15:05

Thanks but it's not the same thing. It has to be more Ticks otherwise the other indicators would not work with live data or would be out of sync.


@one.void

emond.joel
16 Nov 2016, 06:05

Hopefully this can be added soon. It really shouldn't be too hard to give the user an option to specificy their own tick and time frames?


@emond.joel

Spotware
21 Nov 2016, 18:23

Hello, 

We are making very good progress on supporting this feature. Actually it is a very time intensive feature because tick data is so rich and resource intensive to both store and deliver to the trading platforms, nonetheless we will endevour to deliver this ASAP because we know how important this is. 

Many thanks, 

cTrader Team


@Spotware