NinjaScript > Editor > Compile Error Codes >

CS0118

Print this Topic Previous pageReturn to chapter overviewNext page

The following CS0118 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 happen when you use a '()' instead of '[]' for indexing when you reference indicators or properties.

 

To fix this error, please replace the round brackets '()' with the proper square brackets '[]'.

 

Error Description #1
'NinjaTrader.Indicator.IndicatorBase.Close' is a 'property' but is used like a 'method'

 

// Erroneous Sample Code - Miscall of Close property due to use of round brackets

double value = Close(0);

 

// Resolution Sample Code - Proper call of Close property

double value = Close[0];