Custome indicator to combine stacking multiple oscillator indicators

Created at 01 Jul 2020, 17:39
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!
NO

noppanon

Joined 17.05.2017

Custome indicator to combine stacking multiple oscillator indicators
01 Jul 2020, 17:39


Hi there,

   By using cTrader I can stack up oscillator indicators look like this. 

 

 

 

   And in my custom indicator code, I have 2 Output result. Here is sample code.


        [Output("Result", LineColor = "DarkGreen")]
        public IndicatorDataSeries Result { get; set; }

        [Output("Result2", LineColor = "Blue")]
        public IndicatorDataSeries Result2 { get; set; }

 

My custom indicator show like this.

   How can I create custom indicator which 2 stacked oscillator indicators?

Regards,

Noppanon

 

 


@noppanon
Replies

noppanon
01 Jul 2020, 17:44

RE:

noppanon said:

Here is full sample code. 

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Runtime.InteropServices;
using System.Reflection;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class RSIArrow : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Period", DefaultValue = 9, MinValue = 1)]
        public int Period { get; set; }

        [Output("Result", LineColor = "DarkGreen")]
        public IndicatorDataSeries Result { get; set; }

        [Output("Result2", LineColor = "Blue")]
        public IndicatorDataSeries Result2 { get; set; }

        protected RelativeStrengthIndex Indy;
        protected Bars Barz;
        public IndicatorDataSeries Divergence;

        protected override void Initialize()
        {            
            Barz = MarketData.GetBars(TimeFrame, SymbolName);
            Indy = Indicators.RelativeStrengthIndex(Source, Period);
        }

        public override void Calculate(int index)
        {
            Result[index] = Indy.Result[index];
            Result2[index] = Indy.Result[index] * 1.1;
        }
    }
}

 


@noppanon

PanagiotisCharalampous
02 Jul 2020, 08:40

Hi noppanon,

You can't, they need to be two separate indicators.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

noppanon
02 Jul 2020, 10:14

Hi Panagiotis,

   Thank you for confirmation. BTW do you have a plan to enable this feature?

 

Noppanon


@noppanon

PanagiotisCharalampous
02 Jul 2020, 10:18

Hi noppanon,

We do not have such plans at the moment since we did not have demand for such a feature.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous