Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not working correct

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

    Strategy not working correct

    I have created a simple strategy that should buy when the price is above a SMA 60 AND SMA 240.

    Then it should exit when the price hits the SMA 60 or SMA 240 again


    When I backtest this there are alot of trades that qualify for these conditions but are not traded. Also the entry point and exit point are not correct.

    Why?

    I have been trying to find a solution for several days now.


    #2
    Hello L.Williams,

    Welcome to the NinjaTrader forums. You can attach small files directly to this forum with the paper clip icon when composing posts.

    What you will want to do here is follow a debug procedure to track what your strategy is doing. Use plenty of Print() statements to verify values are what you expect.

    Add TraceOrders = true to your Initialize method and you can then view output related to strategy submitted orders through Tools > Output window.

    It may also help to add drawing objects to your chart for signal confirmation. Additional help for these items is available at the following links:

    Debugging your NinjaScript code.
    TraceOrders
    Drawing Objects.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your quick response
      Unfortunately I have no skills in programming at all.
      Which is the main reason I choose Ninjatrader.
      I can however post screenshots of the simple strategy I created, would that help?

      Comment


        #4
        NinjaTrader's automated trading engine is built with C#, a full programming language. You can use the condition builder to get started without programming, but a complete evaluation of your strategies functionality will require a bit of working with code. TraceOrders is very useful for tracking strategy order submission and requires unlocking code.

        If you're not yet ready to work with code, you can use the actions Draw and Print to output window to track what your strategy is doing. Adding visual confirmation through drawing objects can be helpful, and you can still print values to the output window using only the strategy wizard.

        Since you're just getting started, it's also helpful to simplify a good deal the conditions you're evaluating. Use only one condition for entry until you verify everything works as you expect and then start adding additional conditions.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        666 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        377 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        110 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        580 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X