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

Live error

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

    Live error

    Hi

    I'm getting a live order rejection error for a simple logic:

    Exit long market when XYZ happens

    Error: unable to submit market order. TRading suspended affected order: sell 100000 market

    And then another error says that the strategy terminated itself bc of the rejection.

    See attached.

    Why is this happening? It's a market order...forex
    Attached Files

    #2
    Hello calhawk01,

    Thank you for your post.

    So we may investigate this matter further please send us your log and trace files.

    You can do this by going to the Control Center-> Help-> Mail to Platform Support. Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

    Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

    I look forward to assisting you further.

    Comment


      #3
      Ok so I figured out why it's happening. It's happening at 5 PM. At 5 PM market is "close" according to NT, therefore my signals are being rejected. I'm trading currencies so the market should not be close. I'm using the default template for the underlying currency. Are the default templates for currencies have a feature for 5 pm close? That should be removed I think. Should I create a new template?

      another question:

      Is the below needed if i'm submitting a market order in live market?

      Basically I am running the strategy on 60 minute, and i'm submitting the order at the below data series. But given that this is live trading (and not SA), I don't think I need the below? Because my market order will be submited right after the close of 60 minute bar.. at market.... therefore I shouldn't need to 1 minute bars during live trading. However, I would need them for testing purposes during SA. Do you agree that I should remove these for live trading?

      Code:
      			else if (State == State.Configure)
      			{
      				AddDataSeries(SYM, Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Ask);//3
      				AddDataSeries(SYM, Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Bid);//4				
      				BarsRequiredToTrade							= N1;
      			}
      Code:
      			if (Position.MarketPosition == MarketPosition.Flat
      				&& XYZ HAPPENS)
      			{
      				BackBrush = Brushes.CornflowerBlue;		
      				BarBrush = Brushes.Gold;											
      				EnterLong(1,Convert.ToInt32(fxToBuy),  @"Target1");	
      			}
      Last edited by staycool3_a; 02-14-2018, 04:37 PM.

      Comment


        #4
        Hello calhawk01,

        Thank you for your response.

        On your first question are you referring to Currency Pairs? If so, these use a Forex Trading Hours Template by default. You can view this Trading Hours Template under the Control Center > Tools > Trading Hours. You can also create and edit Trading Hours Templates in this window. Please visit the following link for more information: https://ninjatrader.com/support/help...ding_hours.htm

        On the second question you are correct as live trading the strategy will submit to the market data updates and not a specific bars type for the instrument.

        Please let me know if you have any questions.

        Comment


          #5
          Originally posted by NinjaTrader_PatrickH View Post
          Hello calhawk01,

          Thank you for your response.

          On your first question are you referring to Currency Pairs? If so, these use a Forex Trading Hours Template by default. You can view this Trading Hours Template under the Control Center > Tools > Trading Hours. You can also create and edit Trading Hours Templates in this window. Please visit the following link for more information: https://ninjatrader.com/support/help...ding_hours.htm

          On the second question you are correct as live trading the strategy will submit to the market data updates and not a specific bars type for the instrument.

          Please let me know if you have any questions.
          Thanks Pat.

          Another series of questions.

          1) One of my strategy has a logic for system.perf.cumprofits.

          When my strategy is live, it keeps track of historical trades and performance. However, if I disable the strategy, my strategy does not have any data for previous trades and performance that was done LIVE. Even if I right click on the strategy and drill into view performance... it's completely empty. why is that happening?

          I do have the line of code "if historical; return" in my strategy. But I thought that was needed for all live strategies to avoid historical trades done via backtesting etc.

          How can I keep my trade information that was done live in my strategy performance even after I disable it manually and/or NT disables it due to an error. I need my live trade data for position sizing.

          2)

          Another question regarding strategy sync and account position sync

          My start behavior for strategy is "immediately submit and sync." My account is flat. Strategy is flat. My strategy submits an order to buy 100k of XYZ currency. Order is filled. Now my strategy has a 100k and my account/broker also has a 100k position. But under strategy tab, it's saying that my account is not sync. However, I can confirm that my strategy position on strategy tab matches the position on position tab and those two match my position held at my broker. Why would this still say that my position is not sync? Thanks

          Edit** after a couple of hours, now my strategy is "sync" and it's showing My account position but my strategy doesn't have a position... even though my strategy IS the one that created the positions... oh god .

          3)

          Another question

          This is a single instrument strategy. However I do have positions on other instruments at my broker. Ideally, when I turn in a strategy I'd want it to check to see if that particular instrument has a position at my broker, if it does, it can ignore the "entry" logic and then use the "exit" order to manage my position at my broker. Once that position is closed manually or via strategy, it can then start from "beginning" and submit my "entry" based on the strategy logic. Is this a possible scenario that nt8 "start" behavior can handle?

          Thanks
          Last edited by staycool3_a; 02-15-2018, 02:39 PM.

          Comment


            #6
            Hello calhawk01,

            Thank you for your response.

            1. The Real-Time Performance is not kept between runs of the strategy instance. Any trades on the accounts (live or sime) in NinjaTrader can be viewed in the Trade Performance window.

            2. The 'Sync' should be shown if the Strategy and the Account are carrying the same position for the configured instrument. If this is not the case please send us your Log and Trace files.
            You can do this by going to the Control Center-> Help-> Mail to Platform Support. Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.
            Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

            3. This is possible through the 'Adopt Account Position' options. Please refer to the following link for more details: https://ninjatrader.com/support/help...ccountPosition

            I look forward to assisting you further.

            Comment


              #7
              Originally posted by NinjaTrader_PatrickH View Post
              Hello calhawk01,

              Thank you for your response.

              1. The Real-Time Performance is not kept between runs of the strategy instance. Any trades on the accounts (live or sime) in NinjaTrader can be viewed in the Trade Performance window.

              2. The 'Sync' should be shown if the Strategy and the Account are carrying the same position for the configured instrument. If this is not the case please send us your Log and Trace files.
              You can do this by going to the Control Center-> Help-> Mail to Platform Support. Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.
              Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

              3. This is possible through the 'Adopt Account Position' options. Please refer to the following link for more details: https://ninjatrader.com/support/help...ccountPosition

              I look forward to assisting you further.


              1. The Real-Time Performance is not kept between runs of the strategy instance. Any trades on the accounts (live or sime) in NinjaTrader can be viewed in the Trade Performance window.

              This is a big problem for me bc the entire permissive behind my strategy is build on being able to keep a CUMULATIVE track of my profit and loss and adjust position sizing accordingly. I have a "suppose" a million dollar brokerage account and of the million, I'm allocation 100k to this strategy. I want to be able to keep track of how my cumulative profit is as time increases (100k plus 20k profit = 120k) then based on that I want to calculate my new position size on EACH new trade. Are you saying NT can't keep track of this? Then, what's the point of even having this feature (trade.performance) if it can only be used for simulation...? Surely, the developers would have thought that the strategy, when live, will need to be enabled and disabled over time. How can I work around this... without having to manually keep track of my profit and loss for each strategy and adjusting my "overhead" allocation accordingly? Bc clearly there can be MANY reasons to disable and enable a strategy (connection issues, broker rejection order.. syncing........)
              Last edited by staycool3_a; 02-15-2018, 08:32 PM.

              Comment


                #8
                Hello calhawk01,

                Thank you for your response.

                Trade Performance can be used for live trades as well as simulation trades. Please visit the following link: https://ninjatrader.com/support/help...ime__sales.htm

                Your strategy instance will only save it's own Real-Time Performance in the Strategy Performance. If you need to view the live trades made by the strategy outside of the strategy being applied to the chart and right clicking > Strategy Performance > Realtime Performance then you need to use the Trade Performance.

                Please let me know if I may be of further assistance.

                Comment


                  #9
                  Originally posted by NinjaTrader_PatrickH View Post
                  Hello calhawk01,

                  Thank you for your response.

                  Trade Performance can be used for live trades as well as simulation trades. Please visit the following link: https://ninjatrader.com/support/help...ime__sales.htm

                  Your strategy instance will only save it's own Real-Time Performance in the Strategy Performance. If you need to view the live trades made by the strategy outside of the strategy being applied to the chart and right clicking > Strategy Performance > Realtime Performance then you need to use the Trade Performance.

                  Please let me know if I may be of further assistance.


                  Hi Patrick

                  So I figured that given that the default template for spot currencies is same as forex futures, and given that futures markets close briefly at 5 pm —- instead of using the default template for spot currencies, I started using the 24/7 template. However, I had the same error. And it was a rejection of an order that happen at 5 pm and 30 seconds.

                  My strategy is not close at EOD strategy. I’m trading with forex.com using nt8. I just spoke with them and they confirmed that even though spot trading is 24/7, at 5 pm, they “close” trading at 5pm for reconciliation of their clients accounts. However, their data feed is still active. I think this may be causing this error?

                  Is there a solution to this? Can you pls contact your forex.com contacts and see if we can find a resolution to this? Would the same happen through ninja brokerage for forex?

                  This is regarding my original message;

                  Code:
                  Exit long market when XYZ happens
                  
                  Error: unable to submit market order. TRading suspended affected order: sell 100000 market

                  Comment


                    #10
                    Hello calhawk01,

                    Thank you for your response.

                    You would actually just set up a Trading Hours template in NinjaTrader to match the hours you need and then ensure that is the template you select for the strategy on the chart.

                    For information on Trading Hours templates please visit the following link: https://ninjatrader.com/support/help...ding_hours.htm

                    Please let me know if you have any questions.

                    Comment


                      #11
                      Originally posted by NinjaTrader_PatrickH View Post
                      Hello calhawk01,

                      Thank you for your response.

                      You would actually just set up a Trading Hours template in NinjaTrader to match the hours you need and then ensure that is the template you select for the strategy on the chart.

                      For information on Trading Hours templates please visit the following link: https://ninjatrader.com/support/help...ding_hours.htm

                      Please let me know if you have any questions.
                      I don't think that will solve the problem.

                      The template that I am using is a 24/7 hour trading template (comes default with ninjatrader). 5 pm under this template is an active trading hour. Then, why would the orders be getting rejected due to "suspended trading" at 5 pm??

                      Please re-read my previous post and try to understand the actual problem.

                      Thanks

                      Comment


                        #12
                        Hello calhawk01,

                        Thank you for your response.

                        The rejection is due to the strategy submitting an order outside the supported hours for trading from the broker, correct? If your strategy is calculating and submitting orders on hours your broker does not support for trading then the messages you receive are expected. To correct this you would either create a custom Trading Hours template for use with the strategy to prevent it from submitting orders during the unsupported hours for trading or you would implement a time filter in your strategy to ensure it does not submit orders during those times.

                        Trading Hours templates: https://ninjatrader.com/support/help...ding_hours.htm
                        Time filter in strategy to limit trading hours: https://ninjatrader.com/support/foru...ead.php?t=3226

                        Please let me know if you have any questions.

                        Comment


                          #13
                          Originally posted by NinjaTrader_PatrickH View Post
                          Hello calhawk01,

                          Thank you for your response.

                          The rejection is due to the strategy submitting an order outside the supported hours for trading from the broker, correct? If your strategy is calculating and submitting orders on hours your broker does not support for trading then the messages you receive are expected. To correct this you would either create a custom Trading Hours template for use with the strategy to prevent it from submitting orders during the unsupported hours for trading or you would implement a time filter in your strategy to ensure it does not submit orders during those times.

                          Trading Hours templates: https://ninjatrader.com/support/help...ding_hours.htm
                          Time filter in strategy to limit trading hours: https://ninjatrader.com/support/foru...ead.php?t=3226

                          Please let me know if you have any questions.
                          Thanks.

                          The second part of muni question was, does ninja brokerage also “suspend” forex spot trading for a few minutes at 5pm?

                          Also, going back to another question:

                          Is there ANY WAY to save live trading activity for a strategy after it has been disabled and then enabled again. Bc honestly it defeats the purpose of building a strategy based on previous trade performance metrics bc strategies have to be enabled and disabled for a million reasons. Like from my perspective, suppose I’m making trading decisions based on tradeperformance.alltrades.avg mae.. I build my model, tested it on historical data of 10 years... now I’m live and want to use my mae data for live trading... but I can’t bc something happened and I have to disable and enable the strategy... and woala... my mae is not reset. I’m honestly mind blown no one has brought this up... it seriously defeats the purpose of even having every trade performance variable if it cant be saved. You’re never going to have a strategy run for 6+ months within having to reset it.............

                          Comment


                            #14
                            Hello calhawk01,

                            Thank you for your response.

                            On the item concerning NinjaTrader Brokerage please reach out to brokeragesupport[at]ninjatrader[dot]com.

                            For the Disable and Enable and the subsequent re-calculation of the TradePerformance.AllTrades there is no means around this. Strategies are designed to calculate over historical data and would not include information from prior runs. You can however have track your own values and write them to an external file to read from on the start up of the next instance.

                            For information on reading from and writing to a file please visit the following link: https://ninjatrader.com/support/foru...ead.php?t=3477

                            Please let me know if you have any questions.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by trilliantrader, Today, 08:16 AM
                            1 response
                            4 views
                            0 likes
                            Last Post NinjaTrader_BrandonH  
                            Started by bill2023, Yesterday, 08:51 AM
                            3 responses
                            19 views
                            0 likes
                            Last Post bltdavid  
                            Started by yertle, Today, 08:38 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post yertle
                            by yertle
                             
                            Started by Mestor, 03-10-2023, 01:50 AM
                            15 responses
                            378 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by samish18, Yesterday, 08:57 AM
                            10 responses
                            27 views
                            0 likes
                            Last Post samish18  
                            Working...
                            X