Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reference sample question

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

    Reference sample question

    Hi Josh,

    I've tried out the http://www.ninjatrader.com/support/f...ead.php?t=4804 SampleHaltAdvancedStrategy_NT7.zip Reference sample strategy. I'm using NT7 too (the latest). it's working well until the StopStrategy() method. when the CumProfit exceed the -400 Currency then will the strategy halt. I set the TraceOrders to true, and after StopStrategy it gives me an error: **NT** Error on calling 'OnBarUpdate' method for strategy 'Tut092HaltAdvanceStrategyNT7/38164951d59a4725aef67560ffbd3616'.
    -and the objectreference doesen't mach. -
    occures this at You too? or at my PC has the problem? if it no , what can occur it? how can fix it?

    i used if(Historical) return; I attached the script.

    thanks for answer. Tom
    Attached Files
    Last edited by marotom; 05-26-2011, 09:24 AM.

    #2
    Hello marotom,

    The file you posted seems to be using the old approach for IOrders. When comparing equality you do not use .Token but compare IOrders objects directly. Make sure you import the sample intended for version 7.

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      thanks Ryan, I'm using it in the correct form. for NT7. I attached the script to avoid misunderstandings.

      Comment


        #4
        The script you attached is not coded properly. I would delete the one you currently have, and make sure you import this one.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          thanks for the script. this script, that you attached, I'm using. I amended nothing. this is the original script, that can be found on the site. only I've extend with three things, as can be seen: -TraceOrders = true; and if(Historical) return; and DrawTextFixed. the others are the original code! if you found some not properly code it can be in the original. what is is not coded properly in my attached script? thanks for clarify.

          Comment


            #6
            My first reply indicated what is not coded properly. It seems like you just imported the wrong file and will likely get much better results if you delete it and try again with the right one.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_RyanM View Post
              Hello marotom,

              The file you posted seems to be using the old approach for IOrders. When comparing equality you do not use .Token but compare IOrders objects directly. Make sure you import the sample intended for version 7.

              http://www.ninjatrader.com/support/h...nt7/iorder.htm
              thanks for clarify but i don't use the old approach for IOrders, I use without .Token as can you see in my attached file. I'm using this: SampleHaltAdvancedStrategy_NT7.zip was made by Josh and I haven't amended the IOrder methods at all. or perheaps could you initiate Josh in this conversation? please?

              Comment


                #8
                Can you please clarify if the issue you see is with our sample or with the file you attached in your first post? The file you attached in post 1 uses .Token and is incorrect.

                If you are having issues with our file (not yours), let us know how to reproduce and we will give it a run here.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  hello Ryan,

                  I much regret it you have totally right. that I send was the incorrect file with .Token was written for NT6.5. but I tested without .Token was writen for NT7, that you send for me. I attached the right version in question. at this script I noticed this error. try it please! please run it so you can get this error.
                  I attached the right script based on yours, and an screenshot about the error.
                  thanks
                  Attached Files

                  Comment


                    #10
                    Thanks, I believe you can help minimize the chance of this type of error with this change below in StopStrategy(). Include the non-null check anytime you attempt to access the order, including your own print statements. Will have Josh take a look at the sample.


                    In StopStrategy() method:
                    // If our Long Limit order is still active we will need to cancel it.
                    if (myEntryOrder != null)
                    CancelOrder(myEntryOrder);
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_RyanM View Post

                      In StopStrategy() method:
                      // If our Long Limit order is still active we will need to cancel it.
                      if (myEntryOrder != null)
                      CancelOrder(myEntryOrder);
                      Hello Ryan,

                      thanks for help. with this little addition it works as expect. have a nice weekend!

                      Comment


                        #12
                        I'm glad that did the trick, marotom. Thanks for your patience reporting in and following up here.
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          Hello Ryan,

                          let me put another questions to the reference samples to understand better the behavior of NT7.
                          question 1.:
                          I have the strategy in question run and I gave this another error: see picture 1. it enters an internal PlaceOrder() method with MarketQuantity = 0. after it was filled with MarketQuantity = 0,1M namely in the strategy it was set 0,1M using Set order quantity: by default quantity = 100000. why gives me quantity 0 when I definied 0,1M? after this case will again enter an placeorders with quantity=0, but it won't accept it but it will ignor this order that is logical since there isn't quantity. what can happen with it? i'm a little confused.

                          question 2.:
                          I've tried from among the Strategy Reference Samples applicable to NT7 versions:
                          14. Using OnOrderUpdate() and OnExecution() methods to submit protective orders and
                          16. Using CancelOrder() method to cancel orders
                          and gives me this errors at the first entryorder: picture 2, and picture 3. -I add to this the traceorders, and historical return. I attached the scripts to avoid misunderstandings.
                          it's sure to have to run in real-time. could you have it run at you, this occur this problem? where can be the error?
                          thanks for help. Tom
                          Attached Files
                          Last edited by marotom; 06-01-2011, 09:25 AM.

                          Comment


                            #14
                            Hi Tom,

                            Thanks for the post. We need to simplify and clarify a bit here. In the screenshot you posted the name of the signal is given "Sell" but nowhere in the attached files or the sample is this signal name used. I would test with the sample and if you make some changes for easier real-time enablement, you can post the file here and we will give a run.
                            Ryan M.NinjaTrader Customer Service

                            Comment


                              #15
                              Hello Ryan,

                              thanks for answer.
                              - did it succeed to test with the samples in question?
                              - other question: the OnOrderUpdate() will update at this time too when I use an entry method in the OnOrderUpdate()? I mean, I use an entry method in the OnBarUpdate() that I monitor in OnOrderUpdate(). when it is cancelled I open an market entry method in OnOrderUpdate() like in this sample: Using CancelOrder() method to cancel orders.
                              it will update oneself ? -because of it can be occur a looping.-
                              thanks. Tom

                              Comment

                              Latest Posts

                              Collapse

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