Array RSI

Created at 31 Jul 2020, 05:07
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!
SA

samuel.jus.cornelio

Joined 19.03.2020

Array RSI
31 Jul 2020, 05:07


Please, how can I use an indicator array for a bot. For example, an array with several RSI contained. I am trying and not succeeding, if anyone can help I will be grateful


@samuel.jus.cornelio
Replies

firemyst
03 Aug 2020, 06:35

RE:

samuel.jus.cornelio said:

Please, how can I use an indicator array for a bot. For example, an array with several RSI contained. I am trying and not succeeding, if anyone can help I will be grateful

Here's a very simple example using MovingAverages instead:

 

//class declaration
MovingAverage[] _maArray;

//In OnStart (cBot) or Initialize (indicator)
if (_maArray != null)
{
        //Clear out old data everytime we start so GC can collect
	Array.Clear(_maArray, 0, _maArray.Length);
	_maArray = null;
}
_maArray = new MovingAverage[theNumberOfMAObjectsYouWantToHave];

for (int x=0; x < _maArray.Length; x++)
{
	_maArray[x] = Indicators.MovingAverage(Bars.ClosePrices, thePeriodToUse, theMATypeToUse);
}

 


@firemyst