"Crashed in OnStart with ArgumentException: Incorrect parameters count. Parameter name: parameterValues"
            "Crashed in OnStart with ArgumentException: Incorrect parameters count. Parameter name: parameterValues"
            
                 22 Dec 2021, 09:55
            
                    
Hi,
I created a cbot using 3 indicators - one of which is a custom StochasticRSI. Visually, the custom indicator works very well. Its code is available here:
Now, concerning my cbot, I can't get passed this error: "Crashed in OnStart with ArgumentException: Incorrect parameters count. Parameter name: parameterValues".
I read all your documentation. I went through the forum - I am not the first encountering this error apparently. I tried and modified back and forth my cbot's coding. Nothing worked.
Could you help me please?
I can send you the full code by email if you provide an address.
Otherwise, it goes like this:
(I did not introduce any specific parameters from the StochasticRSI indicator in the first section of the code, since the indicator's default values are perfect for my needs and I don't wish to optimize them. Anyway, it didn't change a thing when I tried to insert them specifically and recall them under the "OnStart" section to see if it would resolve the error...)
(And yes, I did select and apply the custom "StochasticRSI" in --> Manage References)
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Strategy1 : Robot
    {
    
        [Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 0.01, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }
        [Parameter("Source")]
        public DataSeries Source { get; set; }
        [Parameter("Bollinger Bands Deviations", Group = "Bollinger Bands", DefaultValue = 2)]
        public double Deviations { get; set; }
        [Parameter("Bollinger Bands Periods", Group = "Bollinger Bands", DefaultValue = 20)]
        public int Periods { get; set; }
        [Parameter("Bollinger Bands MA Type", Group = "Bollinger Bands")]
        public MovingAverageType MAType { get; set; }
        [Parameter("MA Type", Group = "Moving Average")]
        public MovingAverageType MovingAverageType { get; set; }
        [Parameter("MA Periods", Group = "Moving Average", DefaultValue = 9, MinValue = 5, MaxValue = 50, Step = 1)]
        public int MAPeriods { get; set; }
        public string PositionLabel { get; set; }
        private StochasticRSI SRSI;
        private MovingAverage MA;
        private BollingerBands BB;
        protected override void OnStart()
        {
            BB = Indicators.BollingerBands(Source, Periods, Deviations, MAType);
            MA = Indicators.MovingAverage(Source, MAPeriods, MovingAverageType);
            SRSI = Indicators.GetIndicator<StochasticRSI>(Source);
        }
        protected override void OnTick()
        {
...
Thanks in advance for you help!
Replies
                     Mia999
                     22 Dec 2021, 10:14
                                    
RE:
firemyst said:
Well, I'lm not sure how/why you expect the indicator to work that you provided the link to. When I looked at the page, it has numerous parameters that it's expected other than "source":
[Parameter("Source", Group ="Base Settings", DefaultValue ="Close")]
publicDataSeries Source {get;set; }
[Parameter("Oversold Level", DefaultValue = 20, MinValue = 1, Step = 1)]
publicintOversold {get;set; }
[Parameter("Overbought Level", DefaultValue = 80, MinValue = 1, Step = 1)]
publicintOverbought {get;set; }
[Parameter("RSI Periods", DefaultValue = 14, MinValue = 2)]
publicintRSIPeriod {get;set; }
[Parameter("Stochastic K%", DefaultValue = 3, Step = 1, MinValue = 2)]
publicintStochK {get;set; }
[Parameter("Stochastic D%", DefaultValue = 3, Step = 1, MinValue = 2)]
publicintStochD {get;set; }
[Parameter("Stochastic Periods", DefaultValue = 14, Step = 1, MinValue = 2)]
publicintStochPeriods {get;set; }
If you expect to use that one in your cBot, you have to have it something like the following:
Indicators.GetIndicator<StochasticRSI>(Source, Oversold, Overbought, RSIPeriod, STochK, StochD, StochPeriods);with values obviously for all the parameters you supply.
Thanks
@Mia999

firemyst
22 Dec 2021, 10:01
Well, I'lm not sure how/why you expect the indicator to work that you provided the link to. When I looked at the page, it has numerous parameters that it's expected other than "source":
[Parameter("Source", Group ="Base Settings", DefaultValue ="Close")]publicDataSeries Source {get;set; }[Parameter("Oversold Level", DefaultValue = 20, MinValue = 1, Step = 1)]publicintOversold {get;set; }[Parameter("Overbought Level", DefaultValue = 80, MinValue = 1, Step = 1)]publicintOverbought {get;set; }[Parameter("RSI Periods", DefaultValue = 14, MinValue = 2)]publicintRSIPeriod {get;set; }[Parameter("Stochastic K%", DefaultValue = 3, Step = 1, MinValue = 2)]publicintStochK {get;set; }[Parameter("Stochastic D%", DefaultValue = 3, Step = 1, MinValue = 2)]publicintStochD {get;set; }[Parameter("Stochastic Periods", DefaultValue = 14, Step = 1, MinValue = 2)]publicintStochPeriods {get;set; }If you expect to use that one in your cBot, you have to have it something like the following:
with values obviously for all the parameters you supply.
@firemyst