How to adjust indicator values to show correctly in chart

Created at 28 Feb 2016, 17:56
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!
MI

mikepecson72

Joined 15.01.2016

How to adjust indicator values to show correctly in chart
28 Feb 2016, 17:56


Dear Spotware,

I have this long problem that when I make the IsOverlay method to "true", the indicator shows up on the chart but the price disappeared on the chart.

using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None, AutoRescale = true, ScalePrecision = 0)]
    public class test : Indicator
    {

        [Output("ADX", Color = Colors.DarkBlue, Thickness = 2)]
        public IndicatorDataSeries adxr { get; set; }

        [Output("DIMinus", Color = Colors.Red)]
        public IndicatorDataSeries diminus { get; set; }

        [Output("DIPlus", Color = Colors.Green)]
        public IndicatorDataSeries diplus { get; set; }

        private DirectionalMovementSystem adx;


        protected override void Initialize()
        {
            adx = Indicators.DirectionalMovementSystem(21);
        }

        public override void Calculate(int index)
        {
            adxr[index] = adx.ADX[index];
            diminus[index] = adx.DIMinus[index];
            diplus[index] = adx.DIPlus[index];
        }
    }
}

 

But when I set the IsOverlay method back to "false", the indicator shows up properly on separate window and the price restored as normal.

 

using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None, AutoRescale = true, ScalePrecision = 0)]
    public class test : Indicator
    {

        [Output("ADX", Color = Colors.DarkBlue, Thickness = 2)]
        public IndicatorDataSeries adxr { get; set; }

        [Output("DIMinus", Color = Colors.Red)]
        public IndicatorDataSeries diminus { get; set; }

        [Output("DIPlus", Color = Colors.Green)]
        public IndicatorDataSeries diplus { get; set; }

        private DirectionalMovementSystem adx;


        protected override void Initialize()
        {
            adx = Indicators.DirectionalMovementSystem(21);
        }

        public override void Calculate(int index)
        {
            adxr[index] = adx.ADX[index];
            diminus[index] = adx.DIMinus[index];
            diplus[index] = adx.DIPlus[index];
        }
    }
}

 

What do you think is the problem?

How can I make both the indicator and price action shows up on the chart as normal when IsOverlay method to "true".

Thank you.

 


@mikepecson72
Replies

Spotware
29 Feb 2016, 17:43

Dear Trader,

The outputs of the indicators are shown normally on the chart. Please have a look at the output of each indicator in comparison with the OHLC values of the bars.


@Spotware