Is it possible to have a Variable int Parameter for indicator?

Created at 11 Dec 2014, 18:24
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!
EM

emeeder

Joined 06.05.2014 Blocked

Is it possible to have a Variable int Parameter for indicator?
11 Dec 2014, 18:24


 private RelativeStrengthIndex _rsi;

        protected override void Initialize()
        {
            _rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, RSIPeriod);
        }


Replies

emeeder
11 Dec 2014, 20:28 ( Updated at: 21 Dec 2023, 09:20 )

Is it possible to have a Variable int Parameter for indicator?

Sorry, i posted that too early by accident (btw i wish there was a way to edit our own posts in this forum)

What i want to do is instead of defining the Period Parameter in my cbot, i want the Period to be calculated in the cbot itself and then change based on that calculation.

So similar to the code in the HMA indicator (see below), how diff is a variable calculated in the indicator itself. I want to do something similar for the Period. I have tried a similar approach used in HMA Indicator to find 'diff' but that is not working since the Period value needs to be an 'int'.

Does anyone know how to handle that? Please.


emeeder
11 Dec 2014, 20:28 ( Updated at: 21 Dec 2023, 09:20 )

Is it possible to have a Variable int Parameter for indicator?

Sorry, i posted that too early by accident (btw i wish there was a way to edit our own posts in this forum)

What i want to do is instead of defining the Period Parameter in my cbot, i want the Period to be calculated in the cbot itself and then change based on that calculation.

So similar to the code in the HMA indicator (see below), how diff is a variable calculated in the indicator itself. I want to do something similar for the Period. I have tried a similar approach used in HMA Indicator to find 'diff' but that is not working since the Period value needs to be an 'int'.

Does anyone know how to handle that? Please.


AlexanderRC
12 Dec 2014, 16:34

Can you post a minimal "non-working" example? From the description you provide it is not clear at what step you get the error.


@AlexanderRC