impossible to "find" custom indicator in cbot

Created at 16 Nov 2020, 13: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!
NO

Nobody

Joined 14.01.2016

impossible to "find" custom indicator in cbot
16 Nov 2020, 13:29


Hello,

i would like to use this custom indicator in a CBOT but impossible to get it in suggestion list...i add it in cbot references but no change, is there someting in this code that avoid using it please ? what should i change ?

thanks in advance

Alex

 

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 StochasticforIndicators : Indicator
    {
        [Parameter("%K Period", DefaultValue = 9)]
        public int K { get; set; }
        [Parameter("%K Smoothing", DefaultValue = 3)]
        public int Ks { get; set; }
        [Parameter("%K Smoothing Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType Kt { get; set; }
        [Parameter("%D Period", DefaultValue = 9)]
        public int D { get; set; }
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Output("%K")]
        public IndicatorDataSeries KLine { get; set; }
        [Output("%D", LineColor = "Red", LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries DLine { get; set; }

        private IndicatorDataSeries Stochastic;
        private MovingAverage Smoothing, Signal;

        protected override void Initialize()
        {
            Stochastic = CreateDataSeries();
            Smoothing = Indicators.MovingAverage(Stochastic, Ks, Kt);
            Signal = Indicators.SimpleMovingAverage(KLine, D);
        }

        public override void Calculate(int index)
        {
            Stochastic[index] = 100 * (Source[index] - Source.Minimum(K)) / (Source.Maximum(K) - Source.Minimum(K));
            KLine[index] = Smoothing.Result[index];
            DLine[index] = Signal.Result[index];
        }
    }
}


@Nobody
Replies

PanagiotisCharalampous
16 Nov 2020, 13:52

Hi Nobody,

I just tried this and seems to work fine for me

Can you confirm that the indicator builds successfully?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

Nobody
16 Nov 2020, 14:45 ( Updated at: 21 Dec 2023, 09:22 )

RE:

PanagiotisCharalampous said:

Hi Nobody,

I just tried this and seems to work fine for me

Can you confirm that the indicator builds successfully?

Best Regards,

Panagiotis 

Join us on Telegram

Hi Pangiotis,

yes it builds successfully, but in the bot it does not appears even if i add a reference to it via "Manage references" of the cbot options ...


@Nobody

PanagiotisCharalampous
16 Nov 2020, 14:55

Hi Nobody,

If you expect it to appear in cTrader Code Editor, it won't. Try using Visual Studio.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

Nobody
16 Nov 2020, 15:02

RE:

PanagiotisCharalampous said:

Hi Nobody,

If you expect it to appear in cTrader Code Editor, it won't. Try using Visual Studio.

Best Regards,

Panagiotis 

Join us on Telegram

OK, i used it writing it manually and it works fine, thank you !


@Nobody

Nobody
16 Nov 2020, 15:28

RE:

PanagiotisCharalampous said:

Hi Nobody,

If you expect it to appear in cTrader Code Editor, it won't. Try using Visual Studio.

Best Regards,

Panagiotis 

Join us on Telegram

last thing :

i try to use my custom indicator like this :

declaration in the class  :

[Parameter("Third Timeframe (optional)", Group = "SIGNAL SETTINGS")]
public TimeFrame _ms5_timeframe { get; set; }

private RelativeStrengthIndex _rsi_ms5;

private StochasticforIndicators _stoRsi_ms5;

 

and next in functions :

_rsi_ms5 = Indicators.RelativeStrengthIndex(_ms5.ClosePrices, 6);
_stoRsi_ms5 = Indicators.StochasticforIndicators(9, 3, MovingAverageType.Simple, 9, _rsi_ms5.Result);

 

but i get a build error : Erro : "cAlgo.API.internals.IIndicatorsAccessor' dos not contains definition for "StochasticforIndicators" and no extension method 'StocasticforIndicators' accepts for first argumet type 'cAlgo.API.Internals.IIndicatorsAccessor' found (a using directive or assembly reference missing ?)


@Nobody

Nobody
16 Nov 2020, 15:38

RE: RE:

Nobody said:

PanagiotisCharalampous said:

Hi Nobody,

If you expect it to appear in cTrader Code Editor, it won't. Try using Visual Studio.

Best Regards,

Panagiotis 

Join us on Telegram

last thing :

i try to use my custom indicator like this :

declaration in the class  :

[Parameter("Third Timeframe (optional)", Group = "SIGNAL SETTINGS")]
public TimeFrame _ms5_timeframe { get; set; }

private RelativeStrengthIndex _rsi_ms5;

private StochasticforIndicators _stoRsi_ms5;

 

and next in functions :

_rsi_ms5 = Indicators.RelativeStrengthIndex(_ms5.ClosePrices, 6);
_stoRsi_ms5 = Indicators.StochasticforIndicators(9, 3, MovingAverageType.Simple, 9, _rsi_ms5.Result);

 

but i get a build error : Erro : "cAlgo.API.internals.IIndicatorsAccessor' dos not contains definition for "StochasticforIndicators" and no extension method 'StocasticforIndicators' accepts for first argumet type 'cAlgo.API.Internals.IIndicatorsAccessor' found (a using directive or assembly reference missing ?)

replaced last line by this one  :             _stoRsi_ms5 = Indicators.GetIndicator<StochasticforIndicators>(9, 3, MovingAverageType.Simple, 9, _rsi_ms5.Result);

 

and now it builds successfully, could you just confirm it is the good way to work please ?

 

thank you !


@Nobody