Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Unable to compile ninjascript strategy from Tools>Export>Add on Strategy

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

    Unable to compile ninjascript strategy from Tools>Export>Add on Strategy

    I created a Moving Average Cross over Ninja Script Automated Strategy. In my script the FastMA is hard coded. Where as the SlowMA is user input for MA Type and Period. Allowing the user to select either SMA or EMA from a dropdown. Although I am able to easily compile the my strategy in NinjaScript Editor but not able to export it from ninjascript strategy from Tools>Export>Add on Strategy as it is giving my compiling errors.

    For my ninjascript Moving Average crossover strategy I have:
    a private IndicatorBase as "private IndicatorBase SelectMAIndicator(MovingAverageType type, int period)" for this line I am getting the error, "error CS0246: The type or namespace name 'MovingAverageType' could not be found (are you missing a using directive or an assembly reference?)"

    I have also added the SlowMA Indicator Type in my Put parameter as:
    [NinjaScriptProperty]
    [Range(0, int.MaxValue)]
    [Display(Name = "SlowMA Indicator Type", Description = "Type of Moving Average for Slow MA", Order = 3, GroupName = "Parameters")]
    public MovingAverageType SlowMAIndicatorType { get; set; }
    For these lines of codes also I am getting the same Error "error CS0246: The type or namespace name 'MovingAverageType' could not be found (are you missing a using directive or an assembly reference?)"

    Everywhere I used 'MovingAverageType' I am getting the Error "error CS0103: The name 'MovingAverageType' does not exist in the current context"​

    #2
    Hello strategiest007,

    Thanks for your post.

    To clarify, are you trying to access an enum from a custom NinjaScript indicator within your NinjaScript strategy?

    Or, are you adding a user-defined enum input to your NinjaScript strategy?

    Please see the SampleUniversalMovingAverage reference sample from the Help Guide which demonstrates how to add a user-defined enum as an input to a NinjaScript. You could use similar logic to add a user-defined enum to your NinjaScript strategy.

    SampleUniversalMovingAverage: https://ninjatrader.com/support/help...ned_parame.htm

    Note that the fully qualified namespace is used when defining the enum input property in the reference sample.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Trader146, Today, 09:17 PM
    0 responses
    5 views
    0 likes
    Last Post Trader146  
    Started by ttrader23, 05-08-2024, 09:04 AM
    9 responses
    43 views
    0 likes
    Last Post ttrader23  
    Started by ZeroKuhl, Yesterday, 04:31 PM
    8 responses
    46 views
    0 likes
    Last Post ZeroKuhl  
    Started by reynoldsn, Today, 07:04 PM
    0 responses
    11 views
    0 likes
    Last Post reynoldsn  
    Started by puapwr, Today, 06:09 PM
    0 responses
    5 views
    0 likes
    Last Post puapwr
    by puapwr
     
    Working...
    X