Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

When define private variable with custom indicator it print out error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    When define private variable with custom indicator it print out error

    I developed a custom Indicator called mRSI.

    When I do private ATR atr; is not a problem, but when I run private mrsi mRSI;

    I get the following error.
    AmbitiousEquation.cs 'NinjaTrader.NinjaScript.Strategies.Strategy.mRSI( int)' is a 'method' but is used like a 'type' CS0118 48 11

    So I always have to refer it in the strategy directly, like if(Slope(mRSI(14),1,0) > 0) bla bla.. and not if(Slope(mrsi,1,0) > 0)

    See attached working indicator.


    public class AmbitiousEquation : Strategy
    {
    //private SMA smaPeriodHigherTimeFrame;
    private ChoppinessIndex choppinessIndex;
    private ATR atr;
    private mrsi mRSI;​
    Attached Files

    #2
    Hello prisonbreaker82,

    Thanks for your post.

    You are currently calling private mrsi mRSI;​ which would not be correct syntax since the name of the indicator is not all lowercase.

    The fully qualified namespace of the indicator should be used in your script. For example, private NinjaTrader.NinjaScript.Indicators.Isak.mRSI mRSI1;

    The Strategy Builder could be used to set up conditions using the mRSI indicator you shared. Then, you could click the 'View code' button to see the generated syntax for how it should be used in a NinjaScript strategy.

    See this help guide page for more information about working with the Strategy Builder: https://ninjatrader.com/support/help...gy_builder.htm

    Please let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Thank you NinjaTrader_BrandonH
      This helped!
      private NinjaTrader.NinjaScript.Indicators.Isak.mRSI mrsi;

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      77 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X