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 DustyContrer, Today, 04:02 AM
    0 responses
    3 views
    0 likes
    Last Post DustyContrer  
    Started by ETFVoyageur, Today, 02:15 AM
    0 responses
    11 views
    0 likes
    Last Post ETFVoyageur  
    Started by Board game geek, Today, 01:34 AM
    0 responses
    9 views
    0 likes
    Last Post Board game geek  
    Started by morrnel, 05-12-2024, 06:07 PM
    3 responses
    44 views
    0 likes
    Last Post wzgy0920  
    Started by FishTrade, Yesterday, 11:11 PM
    0 responses
    7 views
    0 likes
    Last Post FishTrade  
    Working...
    X