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

Target and stop not triggering?

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

    Target and stop not triggering?

    Hello, I've seen a few other posts with this problem but still having some issues. My targets and stops are working/linking with back testing in the strategy analyzer but when I do it live it doesn't send them. What am I doing incorrectly here? My guess is it's something to do with the IsSimulatedStop/IsMarketIfTouched parameters but not exactly sure. Any help would be greatly appreciated!

    Example from today:
    Attached Files

    #2
    Hello gupagoer,

    Thank you for your post.

    Please send us the Print output of the order object in OnOrderUpdate() so we may investigate this further. Also, please send us the full output from Prints and TraceOrders saved as a text file.

    To save the Prints and TraceOrders from the NinjaScript Output window as a text file, right-click in the NinjaScript Output window and select 'Save as'.

    See the help guide documentation below for more information.
    OnOrderUpdate() - https://ninjatrader.com/support/help...rderupdate.htm
    TraceOrders - https://ninjatrader.com/support/help...aceorders2.htm

    Below is a link to a forum post that demonstrates using prints to understand behavior and including a link to a video recorded using the Strategy Builder.
    https://ninjatrader.com/support/foru...121#post791121

    I look forward to assisting further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      So I will have to wait another day to get order of OnOrderUpdate()'s on live data but I can get it on backtesting data. I've attached everything else below.

      Thank you again, If you need something else let me know.
      Attached Files

      Comment


        #4
        Hello gupagoer,

        Thank you for that information.

        Are you able to reproduce the behavior using the Playback Connection with Market Replay data?

        If so, please send us the Prints output in the NinjaScript Output window when reproducing the behavior with the Playback Connection so we may investigate further.

        See the help guide documentation below for more information about using Playback with Market Replay.
        Playback - https://ninjatrader.com/support/helpGuides/nt8/playback_connection.htm

        I look forward to your reply.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Sorry I didn't attach these last time.

          And I don't think I can use it on Market Replay because it has to load 10 market days of past data prior to the start date.
          Attached Files

          Comment


            #6
            Hello gupagoer,

            Thank you for your note.

            The strategy should be able to be tested using the Playback connection with Market Replay data to simulate the strategy running realtime.

            Prior to using the Playback connection, you would need to ensure that you have enough days of Market Replay data downloaded to use with the Playback connection. For example, if you are testing your strategy for 3 days worth of data and the strategy requires 10 previous days of data, you would need to download 13 days worth of data to use with Playback.

            Before downloading Market Replay data please note:
            • Enable market recording for playback must be disabled from the Market Data category of the Options menu before downloading replay data.
            • Downloading Market Replay data is NOT available when connected to the Playback connection. You must disconnect from the Playback connection prior to downloading.
            To download playback data:
            1. Select the Tools menu in the Control Center, select the menu item Historical Data and select "Load" tab. Here the section "Get Market Replay data" can be expanded.
            2. Select the instrument and date of the desired replay data and press the OK button to begin the download.
            The status of the download will appear in the lower right-hand corner of the Historical Data Window.

            More information about downloading Market Replay data to use with Playback may be found in the NinjaTrader Help Guide link below.
            https://ninjatrader.com/support/help...jaTraderServer

            To connect to Market Replay data:
            1. Left mouse click on the Connections menu in the Control Center
            2. Select the menu item Playback Connection menu item
            The Playback connection should now be connected and the Playback control window will appear. Once the Playback connection is connected click the Play button on the Playback control window and test your strategy.

            More information about how to work with Market Replay data may be found in the NinjaTrader Help Guide link below.
            https://ninjatrader.com/support/help...WithReplayData

            Please let us know if we may be of further assistance.
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              I don't have "Enable market recording for playback" enabled. And I'm not connected to playback and am getting the error "There is no market replay data available for this instrument date" for every Instrument I've tried on a market day.

              I also dont have access to enough tick data to use the historical method either.

              Comment


                #8
                Hello gupagoer,

                Thank you for your note.

                What are the dates of the Market Replay data you are trying to download?
                What instruments are you trying to download Market Replay data for?

                Please note Market Replay data does not come from your data provider, it is provided by NinjaTrader. Market replay is available for the most popular futures and forex instruments for the past 90 days.

                That said, are you able to download data for a range of dates for say the ES 06-21 instrument within the past 90 days to test your strategy with?

                I look forward to your reply.
                Brandon H.NinjaTrader Customer Service

                Comment


                  #9
                  Here's the market replay for two days. The orders were behaving as expected.
                  Attached Files

                  Comment


                    #10
                    Hello gupagoer,

                    Thank you for that information.

                    What time zone are you using?
                    Who is your broker?

                    According to your Backtesting print output and Playback print output, it seems that the stop and target orders are working as expected.

                    However, I do not see print outputs for OnOrderUpdate() as requested in my initial reply.
                    "Please send us the Print output of the order object in OnOrderUpdate() so we may investigate this further."

                    Please add prints to OnOrderUpdate() that print out the order object and comment out all other prints in your script temporarily.

                    After adding the requested prints to the script, please make a copy of the strategy. Below is a link to a video that demonstrates making a copy of a script. Once the copy is created, please modify the copy so that prints appear in Output window 2. See the PrintTo help guide documentation below for how to accomplish this.

                    Making a Copy of a NinjaScript - https://www.youtube.com/watch?v=BA0W...utu.be&t=8m15s
                    PrintTo - https://ninjatrader.com/support/help...t8/printto.htm

                    After doing the above, run the original script Live and the copy script on the Sim101 account. Ensure that both strategies are enabled and run at the same time; one Live, and one on the Sim account. After running the scripts, send us the full output from Prints and TraceOrders saved as a text file for both Output windows.

                    Let us know if we may assist further.
                    Last edited by NinjaTrader_BrandonH; 04-27-2021, 09:02 AM.
                    Brandon H.NinjaTrader Customer Service

                    Comment


                      #11
                      " However, I do not see print outputs for OnOrderUpdate() as requested in my initial reply.
                      "Please send us the Print output of the order object in OnOrderUpdate() so we may investigate this further." "

                      What? I did print out the orders? Did you read the txt file? I've highlighted those parts so you can identify them easier.

                      Sorry I would like to ensure I'm doing this correctly before moving on to the next part.
                      Attached Files

                      Comment


                        #12
                        Hello gupagoer,

                        Thank you for your note.

                        I do see that you are printing the order object in OnOrderUpdate(). Please comment out all other prints in your script temporarily and follow the directions in my previous post. This will allow us to compare the orders placed by your strategy when it is running Live and when it is running on a Sim account. By doing so we would be able to see where the stops and targets are submitted without issue on the Sim account and compare those to the orders placed on the Live account.

                        After adding the requested prints to the script, please make a copy of the strategy. Below is a link to a video that demonstrates making a copy of a script. Once the copy is created, please modify the copy so that prints appear in Output window 2. See the PrintTo help guide documentation below for how to accomplish this.

                        Making a Copy of a NinjaScript - https://www.youtube.com/watch?v=BA0W...utu.be&t=8m15s
                        PrintTo - https://ninjatrader.com/support/help...t8/printto.htm

                        After doing the above, run the original script Live and the copy script on the Sim101 account. Ensure that both strategies are enabled and run at the same time; one Live, and one on the Sim account. After running the scripts, send us the full output from Prints and TraceOrders saved as a text file for both Output windows.


                        I look forward to assisting further.
                        Brandon H.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by cre8able, Today, 01:16 PM
                        2 responses
                        9 views
                        0 likes
                        Last Post cre8able  
                        Started by chbruno, 04-24-2024, 04:10 PM
                        3 responses
                        48 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by samish18, Today, 01:01 PM
                        1 response
                        6 views
                        0 likes
                        Last Post NinjaTrader_LuisH  
                        Started by WHICKED, Today, 12:56 PM
                        1 response
                        9 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by WHICKED, Today, 12:45 PM
                        1 response
                        11 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Working...
                        X