Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT automation issues

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

    NT automation issues

    I have posted at various times about anomalies with NT automation. I have isolated more specifics and so I'm starting a new thread to start clean.

    I have NT 7.0.1000.3, the latest NT. I had to install this because I had to install the Win 7 service pack. So my Win 7 machine is all up to date and the latest NT is running. I also have TWS 911.

    Issues:
    1) Using Market Replay I discovered cases where my emails do not go out from my strategy. It is at market open/close. I understand and agree with the policy that emails only go out during real-time trading. However, it looks like NT is suppressing emails that go out on the last bar of the trading day, or the first bar of the new day, I'm not sure which. I believe NT's mechanism to suppress emails is being too aggressive.
    2) I have discovered that after strategies are enabled and are showing entry/exit points graphically, that connecting to TWS causes the entry/exit graphics to go away. The strategy is still running and I don't think there is anything affected in the strategy, it is just a graphical issue in NT. But I have to re-enable the strategy for NT to wake up and display the entry/exit points again even though all other graphics (the ones I create in the strategy) are intact. I want to be clear here that none of these strategies use IB or TWS data sources or even positions in my IB account. They have nothing to do with TWS connections in any way.
    3) I have stopped using limit orders in NT strategies and use market orders due to other strange behaviors. I believe this is much more robust, and I found there is no loss in performance. I guess a good system can just as easily trade the next 5 or 15 min bar.
    4) Date rollover can be an issue, but these other items are more important. I'll keep tracking the date rollover problems. What I do know is that occasionally on charts with multiple instruments, that the secondary or third instrument does not roll even though the primary does.

    Can I get some answers on items #1 and #2?
    Last edited by tradetree; 03-02-2011, 10:17 AM.

    #2
    Hello TradeTree,

    Can you please outline the scenario more fully when you feel emails should be sent but are not. A code snippet and specific steps will be helpful in reproducing what you're seeing.

    What are the executions you're viewing? Are they actual trades made or virtual? A strategy requires a connection to be enabled, so not sure how you are enabling it before connecting. Are you using another connectivity provider? Walk us through the specific steps needed to see what you're seeing.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I have a strategy that runs during regular futures market hours (<use instrument settings>) on TF, 60 min 06-11 expiration, with a data connection to Vision Financial, but trading account Sim101. It sends out emails upon three conditions:
      1) Trend change but no trade from my code in OnBarUpdate.
      2) About to place a market order for the next bar from my code in OnBarUpdate.
      3) Confirmation from my code in OnExecution of the market order.

      I did a Market Replay several times for Feb 25th and Feb 28th data. I ran it through at 500X playback. Upon the first bar of Feb 28th it decides there is a trend change, but this email does not go out. All other emails go out. Now it is possible that because there is no download data for Feb 26th and Feb 27th that the replay gets confused?

      Today a trade went out for ES, 06-11, 15 min where I have another strategy. It was supposed to email:
      Subject: Confirmation

      Type of trade: S&P 500.
      - This is a broad stock index.

      Date: 3/2/2011 10:45:00 AM, quantity 1, based on price 1306.5 from ES 06-11, 15 Minute.
      * Confirming entered long position UPRO

      I print this to the output window at the same time as submit it for email send. It went to the output window just fine, but never got emailed. Most emails do go out, but it is random which ones do not. This one did not. Can I bypass NTs email interface or something. This is really disturbing.

      Here is the call to send the email:
      string email_address="[email protected]";
      string subject = "Confirmation";
      string final_msg = "Sell";
      Print( "Subject: " + subject );
      Print( final_msg );
      SendMail("[email protected]", email_address, subject, final_msg);

      The final_msg string is more complex than this, but it always displays to the OutputWindow perfectly. The emails also go out many times, and almost always go out without issue under MarketReplay. But during the day they often do not go out. Right now I have built for the debugger and I have a breakpoint on the SendMail call to see that I get there.
      Last edited by tradetree; 03-02-2011, 11:22 AM.

      Comment


        #4
        You can use the property Historical to check if a bar update is real time or not.

        If Historical is true, then we do not expect NinjaScript to send the email. Include the line in bold below to verify.

        string email_address="[email protected]";
        string subject = "Confirmation";
        string final_msg = "Sell";
        Print( "Subject: " + subject );
        Print( final_msg );
        Print(Historical.ToString());
        SendMail("[email protected]", email_address, subject, final_msg);
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I have added that and will report back on my results. I will run MarketReplay this evening and see what it does in that condition, and then what it does during the day. Another question, can I utilize a C# dll for another application and call it from within my strategy? I would like to collect some of my strategy code into a dll and then call it from OnBarUpdate.

          Comment


            #6
            Yes, you can use external dlls in your NinjaScript code. You add these from within the NinjaScript editor. Right Click > References screen.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Do you have an example somewhere of creating a simple dll using Visual Studio that is then called from an NT strategy? I found some things on eSignal and Tradestation dll's but it does not give a simple example of creating a dll, just using one that is already created.

              Comment


                #8
                Also, here is the result of an event. Historical is "True" so it doesn't send the email. Why is historical true for a real-time chart? It is set to 3/2/2011 and <use instrument settings>. The bars are updating on my NT chart.:

                Subject: Trend Change

                Type of trade: S&P 500.
                - This is a broad stock index.

                Date: 3/2/2011 2:45:00 PM, quantity 2, based on price 1304.75 from ES 06-11, 15 Minute.
                * Changed to long trend.


                True

                Comment


                  #9
                  Unfortunately we don't have an example for Visual studio dlls. Their documentation is likely the best place to look for this.

                  The Historical property is working as expected here with market replay. Can you please break down the exact steps we can use that show realtime (or simulated real time) bar reported as historical?
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    I have struggled with the strategy sync for some time. This is really easy in Tradestation, but incredibly difficult in NT. In Tradestation they have a strategy tab with the strategy position and your position. If you setup the options, you can always take the next trade no matter if you are in sync or not. In NT it is not so simple. I have now gone back to setting the "Immediately submit live working historical orders" and I've cleared out any orders that are outstanding. What I now think is going on is that NT does not differentiate a position based on the strategy. So if you have two strategies on the same instrument (even though they are different time frames), one strategy chokes on the other strategies order. It thinks it placed the order! Is this the case? Does NT have any plans to get a better paradigm?

                    Comment


                      #11
                      Can you please create a new thread for any new topics? You started this thread for market replay email issues and would like to see that resolved here before moving onto other issues.

                      Can you please break down the exact steps we can use that show realtime (or simulated real time) bar reported as historical?
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #12
                        Ryan, My intent was to stay on topic as well. I don't know what you are looking for? I have a chart with ES 06-11, 15 min bars. I have a strategy enabled in that chart. I have a second chart with ES 06-11, 60 min bars. I have the same strategy enabled in that chart. In the strategy tab both are enabled, but were yellow. The rest of what took place I already posted. It prints out Historical equal True. Why? I started speculating as to why in the absence of specific questions. I was not starting another topic.

                        Comment


                          #13
                          Historical should be true for historical bars. There are still historical bars available in market replay. Only bars that are played back in market replay should be Historical = false.

                          It's working as expected in my tests. If you see something different, we need to turn your experience into steps we can use to see this behavior on our end.

                          Attached is a script you can run so we're on the same page with what is expected for Historical property and market replay.

                          1) Apply it to a chart with market replay paused. It should list the cb value + True for all bars.

                          2) Playback market replay feed. It should indicate cb value + False for all the bars currently playing back.
                          Attached Files
                          Ryan M.NinjaTrader Customer Service

                          Comment


                            #14
                            Correct, I get the expected result:
                            18607 True
                            18608 True
                            18609 True
                            (Startup replay bars)
                            18610 False
                            18611 False
                            18612 False
                            18613 False

                            Also, my output of my email text to the OutputWindow shows Historical == False for the playback bars, and my email goes out and is received in my inbox. So we are in complete agreement on expectations for MarketReplay. It is the real-time that makes no sense. For real-time data I get Historical == True. This is where I went off onto a tangent in my last post. Why would NT be displaying new bars in a chart as they come in during the day and Historical == True?

                            Now I fully expect that this won't happen tomorrow. But I'll keep using this indicator and let you know when it happens again. My theory, as I stated, is that NT is confused between two strategies both trading one instrument. Could you comment on that?
                            Last edited by tradetree; 03-02-2011, 04:49 PM.

                            Comment


                              #15
                              Glad to hear the basic functionality works for you.

                              I'm not sure why you are seeing true reported for real time bars. If you can provide the steps needed to see this on my end, I'm happy to follow the steps and compare. Any issues we discover can be reported and fixed.

                              Turn off NinjaTrader, restart it, and start making note of any mouseclicks you make in the platform. Send these mouseclicks to us and I'll then make the same ones. If it requires a custom script to see the issue, then reduce the script down to the minimum necessary to see an issue, and share the script with us.

                              If it's easier, record what you're doing in a video and share the recording. You can use free software like jing for this and share large files using FileXpressit.com.

                              We can't confirm any theories you have on this without seeing what you're doing.
                              Ryan M.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Barry Milan, Yesterday, 10:35 PM
                              5 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by DanielSanMartin, Yesterday, 02:37 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post DanielSanMartin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              4 responses
                              13 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by terofs, Today, 04:18 PM
                              0 responses
                              12 views
                              0 likes
                              Last Post terofs
                              by terofs
                               
                              Started by nandhumca, Today, 03:41 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post nandhumca  
                              Working...
                              X