NinjaScript > Editor > Compile Error Codes >

CS1502

Print this Topic Previous pageReturn to chapter overviewNext page

The following CS1502 error code information is provided within the context of NinjaScript. The examples provided are only a subset of potential problems that this error code may reflect. In any case, the examples below provide a reference of coding flaw possibilities.

 

Error Code Explanation

This error can occur when you pass in incorrect parameter object types into a method such as an indicator.

 

Please check the overload methods for the proper parameter object types and pass in the proper object. You can check the overload methods with NinjaScript editor’s Intellisense when you call a method.

 

Error Description #1
The best overloaded method match for 'NinjaTrader.Data.DataSeries.Set(double)' has some invalid arguments

 

// Erroneous Sample Code - Close is a DataSeries object type and is not a valid value to the Set() method

Plot0.Set(Close);

 

// Resolution Sample Code - The Set() method takes a double value so pass in Close[0]

Plot0.Set(Close[0]);

 

Error Description #2
The best overloaded method match for 'NinjaTrader.Indicator.Indicator.SMA(NinjaTrader.Data.IDataSeries, int)' has some invalid arguments

 

// Erroneous Sample Code - Using an integer when the first parameter should be a DataSeries

double myValue = SMA(5, 5);

 

// Resolution Sample Code - 'myValue' will take the value of the current bar's SMA

double myValue = SMA(Close, 5)[0];