How to add Supertrend indicator to Bot

Created at 05 Aug 2020, 03:31
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!
RG

rgasch

Joined 14.12.2017

How to add Supertrend indicator to Bot
05 Aug 2020, 03:31


I'm trying to add the built-in Supertrend indicator using the following code:

private Supertrend    _st;
protected override void OnStart()
{
    _st = Indicators.GetIndicator<Supertrend>(10, 3);
}

but this results in the following error: 

Error CS0311: The type 'cAlgo.API.Indicators.Supertrend' cannot be used as type parameter 'TIndicator' in the generic type or method 'cAlgo.API.Internals.IIndicatorsAccessor.GetIndicator<TIndicator>(params object[])'. There is no implicit reference conversion from 'cAlgo.API.Indicators.Supertrend' to 'cAlgo.API.Indicator'.

Can someone please advise me on how to get this to work? Thank you in advance.


@rgasch
Replies

PanagiotisCharalampous
05 Aug 2020, 08:30

Hi rgasch,

Here is the correct way to do this

        private Supertrend _st;
        protected override void OnStart()
        {
            _st = Indicators.Supertrend(10, 3);
        }

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

rgasch
05 Aug 2020, 13:06

RE:

Yes, this works. Thank you!

 

PanagiotisCharalampous said:

Hi rgasch,

Here is the correct way to do this

        private Supertrend _st;
        protected override void OnStart()
        {
            _st = Indicators.Supertrend(10, 3);
        }

Best Regards,

Panagiotis 

Join us on Telegram

 

 


@rgasch