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

NT8 Strategy Builder Not Working

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

    NT8 Strategy Builder Not Working

    Hello,

    I created a simple MACD strategy using the builder but it doesn't appear to work even after enabling it on the chart in my sim account. I looked at the error log and found a bunch of messages neither of which read like an error to me. Can you please check and advise what I might be doing wrong?

    The strategy doesn't work on the Strategy Analyzer either. It runs but produces nothing.

    Thanks for your help.




    #2
    bumping this up for support

    Comment


      #3
      Hello givemefood,

      It looks like you are connected to the Simulated Data Feed which is fake real-time data only, and is not market data, and does not have historical data. The Strategy Analyzer requires historical data.

      See this forum post about data.


      You will need to see chart bars loading on the chart to confirm there is data there.

      The messages about orders being ignored are because they are being submitted before CurrentBar is equal to or greater than BarsRequiredToTrade. Either change the condition to wait until CurrentBar is greater than 20, or set BarsRequiredToTrade to 1 and require CurrentBar to be greater than 1.

      To understand why orders are or are not being submitted, enable TraceOrders and in a condition set with no conditions, print the time of the bar and all values used in the conditions that submit the order.

      Below is a link to a forum post on using TraceOrders and Print() to understand behavior. Please watch the video 'Debugging using prints with the Strategy Builder'.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        I'm connected to my live account and can see the tick candles move. However, I switched to the Sim License to enable testing of the Strategy builder.

        I didn't write a code but used the "strategy builder" feature to try this out. I'm not coding. I followed the instructions delivered by Brett Barrett from NT available on this link. Very simplistic. Nothing complex. In there he's left the value for "Bars required to trade" at 20.

        However, based on your suggestion I changed that value to 1. I still can't get the strategy to work on the chart or "backtest" via Strategy Analyzer.

        I've attached screenshots of the Log and the code from the strategy builder.

        What else am I missing?

        Comment


          #5
          Here's the error log
          Attached Files

          Comment


            #6
            Forgot the compile the strategy earlier. The attached screenshot is the log after the strategy was compiled and run.
            Can you please advise what I may be doing wrong?

            Thanks.

            Click image for larger version

Name:	latest error log.png
Views:	129
Size:	203.5 KB
ID:	1213672

            Comment


              #7
              Hello givemefood,

              Yes, I understand you created the script with the Strategy Builder which generated the code. None the less, you will need to enable TraceOrders and add prints in the strategy builder to understand the behavior.

              What you may be doing wrong, is having conditions that are not evaluating as true, or orders that are being ignored, or orders that are being automatically cancelled. The TraceOrders and prints will tell you exactly what is wrong.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks.
                I think I got passed those errors. Now, I can't get the Strategy to "Enable". I can pull up the strategy to run it on the chart. It allows me to check "Enabled" but when Apply or OK is clicked, the strategy doesn't enable. The checkbox gets unchecked automatically.
                Any clues?

                Attached Files

                Comment


                  #9
                  Hello givemefood,

                  The errors are stating you have invalid logic in OnStateChange(). 'Object reference not set to instance of an object' means a variable with a null value was attempted to be used.

                  A common reason for this is improperly attempting to use indicator or price information for stop losses or profit targets.
                  Hello support team, I have 2 dataseries, a 1minute to detect the ATR value. Now I would like to set the stoploss and profit target based on the actual ATR Value Example: Stoploss 2xATR Profittarget 3xATR value 1. How can this be done with builder, I have no coding experience 2. Later I would like to have the possibility to

                  https://ninjatrader.com/support/foru...596#post806596

                  Indicators and price series cannot be used for set methods in the Strategy Builder as these are set in State.Configure, before the indicators or price series exist.

                  Are you attempting to use indicator plot series or price series for a set method?
                  Last edited by NinjaTrader_ChelseaB; 08-30-2022, 01:55 PM.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Nevermind. I fixed it. Thanks for your help. Please close this thread.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Balage0922, Today, 07:38 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post Balage0922  
                    Started by JoMoon2024, Today, 06:56 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post JoMoon2024  
                    Started by Haiasi, 04-25-2024, 06:53 PM
                    2 responses
                    19 views
                    0 likes
                    Last Post Massinisa  
                    Started by Creamers, Today, 05:32 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post Creamers  
                    Started by Segwin, 05-07-2018, 02:15 PM
                    12 responses
                    1,786 views
                    0 likes
                    Last Post Leafcutter  
                    Working...
                    X