Candle Range Pips Count

Created at 06 Jul 2017, 18:58
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!
ST

Storm31

Joined 10.10.2016

Candle Range Pips Count
06 Jul 2017, 18:58


I would be grateful if anyone anyone could please make a small change to this code so that the Pips display the entire range of the candle from high to low? Right now it display only the Pips of the Real Body.

This code was kindly posted by Kate, way back in 2013.

Thanks to anyone that can help.

 

using System;

using cAlgo.API;

using cAlgo.API.Indicators;

 

namespace cAlgo.Indicators

{

    [Indicator(IsOverlay = true)]

    public class CandleSize : Indicator

    {

        public override void Calculate(int index)

        {

            double candleSize = Math.Abs(MarketSeries.Open[index] - MarketSeries.Close[index]);

            double candleSizePips = Math.Round(candleSize / Symbol.PipSize, 3);

         

            ChartObjects.DrawText(

                index.ToString(), candleSizePips.ToString(),  // object name and text

                index, MarketSeries.High[index],  // location

                VerticalAlignment.Top, HorizontalAlignment.Center);

        }

    }

}

 


@Storm31
Replies

croucrou
07 Jul 2017, 22:43

using System;

using cAlgo.API;

using cAlgo.API.Indicators;

 

namespace cAlgo.Indicators

{

    [Indicator(IsOverlay = true)]

    public class CandleSize : Indicator

    {

        public override void Calculate(int index)

        {

            double candleSize = Math.Abs(MarketSeries.Low[index] - MarketSeries.High[index]);

            double candleSizePips = Math.Round(candleSize / Symbol.PipSize, 3);

         

            ChartObjects.DrawText(

                index.ToString(), candleSizePips.ToString(),  // object name and text

                index, MarketSeries.High[index],  // location

                VerticalAlignment.Top, HorizontalAlignment.Center);

        }

    }

}

 


@croucrou

Storm31
07 Jul 2017, 23:03

RE:

Thank you!

 

 

croucrou said:

using System;

using cAlgo.API;

using cAlgo.API.Indicators;

 

namespace cAlgo.Indicators

{

    [Indicator(IsOverlay = true)]

    public class CandleSize : Indicator

    {

        public override void Calculate(int index)

        {

            double candleSize = Math.Abs(MarketSeries.Low[index] - MarketSeries.High[index]);

            double candleSizePips = Math.Round(candleSize / Symbol.PipSize, 3);

         

            ChartObjects.DrawText(

                index.ToString(), candleSizePips.ToString(),  // object name and text

                index, MarketSeries.High[index],  // location

                VerticalAlignment.Top, HorizontalAlignment.Center);

        }

    }

}

 

 


@Storm31

Acrovyn
13 Aug 2020, 14:28

RE: RE: I got some help from a friend, try this. Pips without decimal.
using System;

using cAlgo.API;

using cAlgo.API.Indicators;



namespace cAlgo.Indicators
{


    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]

    public class PipCounter2 : Indicator
    {
        [Obsolete()]
        public override void Calculate(int index)
        {

            double candleSize = Math.Abs(MarketSeries.Low[index] - MarketSeries.High[index]);

            double candleSizePips = (int)Math.Round(candleSize / Symbol.PipSize, 3);




            // object name and text
            // location
            ChartObjects.DrawText(index.ToString(), candleSizePips.ToString(), index, MarketSeries.High[index], VerticalAlignment.Top, HorizontalAlignment.Center);


        }

    }

}

Storm31 said:

Thank you!

 

 

croucrou said:

using System;

using cAlgo.API;

using cAlgo.API.Indicators;

 

namespace cAlgo.Indicators

{

    [Indicator(IsOverlay = true)]

    public class CandleSize : Indicator

    {

        public override void Calculate(int index)

        {

            double candleSize = Math.Abs(MarketSeries.Low[index] - MarketSeries.High[index]);

            double candleSizePips = Math.Round(candleSize / Symbol.PipSize, 3);

         

            ChartObjects.DrawText(

                index.ToString(), candleSizePips.ToString(),  // object name and text

                index, MarketSeries.High[index],  // location

                VerticalAlignment.Top, HorizontalAlignment.Center);

        }

    }

}