Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Questions regarding development of strategy in Ninjascript

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

    Questions regarding development of strategy in Ninjascript

    Greetings and thanks for reading my post and questions!

    My name is Tim and I have been trading on ninjatrader for about 6 months using a successful strategy but it is consuming a lot of my time watching markets constantly, missing trades at times, etc and I'm really interested in creating an automated trading bot in the platform that will do the trading for me.

    My strategy is not super complex but it does involve:

    shooting star pattern,
    EMAs,
    Trailing stops,
    stop market orders,

    I have tried the strategy building wizard and it has its limitations, as I've found out that I will need to manually write the code or need help with someone to write me the code for my strategy by unlocking the code and having it written in.

    My questions:

    1. Is there a learning tutorial about writing code with ninjascript or does this learning entail multiple classes in coding and take months to years to develop a good working knowlege?

    2. I have used chat GPT to assist me before with ideas, but it's very hit and miss and sometimes the chat GPT makes assumptions which can't actually be done or create errors when I use its ideas. (For example it assumed I could put in certain things into the strategy building wizard that simply could not be done). Is chat GPT recommended for someone like me to assist or will it always write imperfect code that will not work with ninjatrader?

    3. What resources are available for someone to assist me with writing the code? Is this a for-profit company, or self-employed paid coders, or simply people who enjoy coding and do it to help others free of charge for their own gratification of helping others?

    Thanks for the response(s)!!


    Tim







    #2
    Hello Tim,

    Welcome to the NinjaTrader forums!

    I see you have posted in the NinjaTrader 7 section of the forums.

    Please note, NinjaTrader 7 is no longer in active development and we are no longer considering new feature requests or changes for NinjaTrader 7. Main development has shifted to our flagship platform NinjaTrader 8. This does mean updates from brokerages, data feeds, or operating systems that require an update in NinjaTrader will not be implemented in NinjaTrader 7 and may cause an interruption in service.

    While there is not a set ETA for the complete discontinuation of NinjaTrader 7, we highly recommend transitioning to NinjaTrader 8 as soon as possible before NinjaTrader 7 reaches its end of life to prevent interruption of service.

    Click below to download NinjaTrader 8.
    https://account.ninjatrader.com/welcome-download

    For NinjaTrader 8 related inquiries, please post in the NinjaTrader 8 section of the forums.



    "I'm really interested in creating an automated trading bot in the platform that will do the trading for me.

    My strategy is not super complex but it does involve:

    shooting star pattern,
    EMAs,
    Trailing stops,
    stop market orders,"

    Calling the CandleStickPattern indicator from the Strategy Wizard or an unlocked strategy would allow for finding patterns. This will plot a value of 1 when a pattern is found and 0 when no pattern is found.



    The EMA indicator can be called from the Strategy Builder or an unlocked strategy.



    I have a link to an example of trailing stop behavior logic with the NinjaTrader 7 Strategy Wizard and NinjaTrader 8 Strategy Builder.



    However, I only have an example of trailing stop behavior in an unlocked script in NinjaTrader 8.



    "Is there a learning tutorial about writing code with ninjascript or does this learning entail multiple classes in coding and take months to years to develop a good working knowlege?"

    A basic understanding of C# programming is prerequisite to writing NinjaScript code.

    Below is a link to a support article with helpful resources on getting started with C# and NinjaScript.



    There are some third party educational sites that teach NinjaScript.



    "I have used chat GPT to assist me before with ideas, but it's very hit and miss and sometimes the chat GPT makes assumptions which can't actually be done or create errors when I use its ideas. (For example it assumed I could put in certain things into the strategy building wizard that simply could not be done). Is chat GPT recommended for someone like me to assist or will it always write imperfect code that will not work with ninjatrader?"

    From our experience at this time, ChatGpt and other AI models are not quite adequate to generate valid compilable NinjaScripts that function as the user has intentioned. We often find that the generated code will call non-existent properties and methods, use improper classes or inheritance, and may have incorrect logic. We highly encourage that you create a new NinjaScript yourself using the NinjaScript Editor, and use the code generated by ChatGpt as more as suggestions and guide than the actual code generated.

    Below is a link to a forum thread that discusses ChatGpt and it's limitations.


    While it would not be within our support model to correct these scripts at user request, we would be happy to provide insight for any direct specific inquiries you may have if you would like to create this script yourself. Our support is able to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior.

    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.​

    That said, I have heard good things about Claud.Ai being pretty good at programming related tasks.


    "What resources are available for someone to assist me with writing the code? Is this a for-profit company, or self-employed paid coders, or simply people who enjoy coding and do it to help others free of charge for their own gratification of helping others?​"

    Unfortunately, I would be able to provide much more resources than the ones available in the 'Getting Started with NinjaScript' articles linked above.

    This thread will remain open for any community members that would like to add additional helpful resources.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks very much for your reply!


      Perhaps you (or someone from the community) can help me with a few things I'm having an issue with in the strategy builder.


      First, I'd like to write in my strategy:

      "When the body of the candle is within the top 30% of the (high - low) price of the candle"

      Additionally, how to I input:

      "When the body of the candle touches the 8EMA"

      Thanks for the input!

      Comment


        #4
        Hello Tim,

        Your post is in the NinjaTrader 7 section of the forums.
        To confirm, is this for the Strategy Wizard in NinjaTrader 7, or the Strategy Builder in NinjaTrader 8?

        "When the body of the candle is within the top 30% of the (high - low) price of the candle"

        Doing math is not really suited for the Strategy Wizard. The only math available is with offsets on price series and indicators.

        Be sure you have watched the 'Strategy Wizard 301' training video.


        The NinjaTrader 8 Strategy Builder can add custom series to do some limited math, but we usually suggest unlocking the script if you have custom logic and calculations.

        The Strategy Wizard is mostly only capable of left and right comparisons.


        "When the body of the candle touches the 8EMA"

        In the Condition Builder click the plus "+" to expand Price data then select Close, in the center select CrossAbove, on the right click the plus to expand Indicators, select EMA, set Period to 8.
        Add another condition, select Price data > Close, in the center select CrossBelow, on the right select Indicators > EMA, set Period to 8.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        574 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        332 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        553 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X