3.7 Too many nested indicators created.

A.R.  since: 14 Oct 2018; 
 05 Dec 2019, 08:33
3.7 Too many nested indicators created.

version 3.7 Great!
playing around with it pops up the following question.
What is the max of sub-indicators you can have in a indicator after 17 is says there are too many.


private Class RSIs
{
  public RelativeStrengthIndex dataSeries;
  public PairInfo(Indicator thisRobot, Symbols)
  {
    foreach(string SymbolName in Symbols)
    {
      try
       {
         Bars bars = thisRobot.MarketData.GetBars(TimeFrame.Minute, SymbolName);
         if (bars == null)
           dataSeries = null;
         else
           dataSeries = thisRobot.Indicators.RelativeStrengthIndex(bars.ClosePrices, Periods);
       }
       catch (Exception ex)
       {
         dataSeries = null;
       }
    }
  }
}

and how to overcome this Maximum?

Panagiotis Charalampous's avatar
Panagiotis Charalampous since: 13 Jan 2017; 
 05 Dec 2019, 10:32

Hi A.R.

Can you please explain where does it say it is too many? Can you provide a complete cBot code that will allow us to reproduce the message?

Best Regards,

Panagiotis

Head of Community Management at cTrader
abc  since: 06 Feb 2017; 
 05 Dec 2019, 13:26
RE: 3.7 Too many nested indicators created.

Shares4UsDevelopment said:

version 3.7 Great!
playing around with it pops up the following question.
What is the max of sub-indicators you can have in a indicator after 17 is says there are too many.


private Class RSIs
{
  public RelativeStrengthIndex dataSeries;
  public PairInfo(Indicator thisRobot, Symbols)
  {
    foreach(string SymbolName in Symbols)
    {
      try
       {
         Bars bars = thisRobot.MarketData.GetBars(TimeFrame.Minute, SymbolName);
         if (bars == null)
           dataSeries = null;
         else
           dataSeries = thisRobot.Indicators.RelativeStrengthIndex(bars.ClosePrices, Periods);
       }
       catch (Exception ex)
       {
         dataSeries = null;
       }
    }
  }
}

and how to overcome this Maximum?

Hi Panagiotis,

I have many Custom Indicators that use a large number of Nested Indicators. Yesterday they were all displaying outputs in CTrader Automate , but today with the new version 3.7, they are not.

Is the number of Nested Custom Indicators that is allowed to be used in a Custom Indicator, a restriction with cTrader and cAutomate? If it is then all my work of previous years (when there was no such restriction) is a waste. Hoping that there is no such restriction for Custom Indicators. (I understand that this may be a problem in automated optimazatioin. However, it should not stop Custom Indicators from using as many Nested Indicators as needed as long as they don't use automated optimization or backtesting.) Thanking you.

Panagiotis Charalampous's avatar
Panagiotis Charalampous since: 13 Jan 2017; 
 05 Dec 2019, 14:04

Hi,

I am not aware of such restriction, it sounds like a StackOverflow exception but I cannot advise further if I cannot reproduce your problem.

Best Regards,

Panagiotis 

Join us on Telegram

Head of Community Management at cTrader
A.R.  since: 14 Oct 2018; 
 05 Dec 2019, 14:21
Sample indicator showing Too many nested indicators created.
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 TooMany : Indicator
    {
        string[] TestSymbols = { "EUR","USD","GBP","AUD","CAD","JPY","CHF","NOK","XAU","XAG","XPD","XPT","ZAR"};
        RelativeStrengthIndex RSI;
        protected override void Initialize()
        {
            foreach(string basepair in TestSymbols)
            {
                foreach(string counterpair in TestSymbols)
                {
                    if (basepair == counterpair) continue;
                    string SymbolName = basepair + counterpair;
                    try
                    {
                        Bars bars = MarketData.GetBars(TimeFrame.Minute, SymbolName);
                        if (bars == null)
                            RSI = null;
                        else
                            RSI = Indicators.RelativeStrengthIndex(bars.ClosePrices, 14);
                    }
                    catch (Exception ex)
                    {
                        Print(basepair + counterpair," ",ex.Message);
                        RSI = null;
                    }
                }
            }
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = ...
        }
    }
}

Also you will notice that a line like "05/12/2019 13:18:11.948 | Failed to get symbol 'ZARXPT': symbol not found." is written in the log whilst it would be nicer to just throw an error that's catched with a try{}catch(e){} so we can choose to displays that message and is's not mandatory.

Panagiotis Charalampous's avatar
Panagiotis Charalampous since: 13 Jan 2017; 
 05 Dec 2019, 17:20

Hi A.R.

Thanks for the code. We managed to reproduce it and it seems to be an issue on our side. We will fix it in an update.

Best Regards,

Panagiotis 

Join us on Telegram

Head of Community Management at cTrader
Panagiotis Charalampous's avatar
Panagiotis Charalampous since: 13 Jan 2017; 
 10 Dec 2019, 08:13
RE:

Hi A.R.

We have fixed this issue with the latest update on Spotware Beta. Please have a look and let us know if it has been resolved for you.

Best Regards,

Panagiotis 

Join us on Telegram

Head of Community Management at cTrader