Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OCO Market Order error

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

    OCO Market Order error

    If I click on "Buy Market" or "Sell Market" in Chart Trader, the order is entered. I have a simple ATM strategy associated with it, e.g., stop loss and profit, with no other parameters.
    The order is entered but not the associated closing orders.
    I receive the following error message in the attachment.
    It only happens occasionally, except for certain windows, where it always happens Click image for larger version

Name:	Error message.jpg
Views:	389
Size:	16.5 KB
ID:	1199413 ; the OCO order is not checked when right clicking on the ATM panel.

    #2
    Hello sgordet,

    Can you please rename the database and check if the issue persists.
    • Shutdown NinjaTrader and go to the Windows Start Menu
    • Select Documents--> NinjaTrader 8--> db--> "NinjaTrader.sdf" file (may only say 'NinjaTrader' depending on your Windows File Explorer settings)
    • Right click on NinjaTrader.sdf and select "Rename". Name it "OLDNinjaTrader.sdf"
    • Then restart the software and NinjaTrader will create a fresh database file to use
    • Unfortunately the following items stored in the old database will not be present anymore - Trading Hours templates, Instrument Lists / Custom Instruments, historical trade execution data, saved Strategy Analyzer backtest results
    JasonNinjaTrader Customer Service

    Comment


      #3
      First of 3 messages:
      Is there a way that I can save and restore the items which will be deleted?
      Last edited by sgordet; 05-01-2022, 09:41 AM.

      Comment


        #4
        I think that all I will really need of those items is the historical trade execution data if it's for the live account.

        Comment


          #5
          I closed NT and made a backup of the sdf file in another folder before following your instructions.
          Same error (new attachment) Click image for larger version  Name:	Error 2.jpg Views:	0 Size:	17.5 KB ID:	1199448 . Should I re-install my old sdf file?

          By the way, my old instrument lists haven't been deleted from the drop down. They're still there.
          The problem happens mostly with MGC and it doesn't matter if I create a new window--it still happens. If I go to another window with a different instrument, where the ATM is working fine and change it to MGC, he problem occurs again. Should I delete MGC historical from the database?

          Add'l troubleshooting notes.
          1. Deleted all MGC historical data--didn't help.
          2. I hadn't noticed that there was an additional error message below the one that I've attached. It's attached now.
          3. I tried using different ATM strategies, which worked fine with other instruments, and got the same error messages and the closing stop and target didn't appear.
          4.. The problem appears to be only with trade-initiating buy orders, not sell orders.


          Click image for larger version  Name:	Error 3.jpg Views:	0 Size:	11.4 KB ID:	1199451
          Last edited by sgordet; 05-01-2022, 10:32 AM.

          Comment


            #6
            I also see this issue. I am on 8.0.25.0 with a clean install of Ninja Trader on 4/28.
            I I do not see a way to create a new OCOID

            I would expect to be able to create my own if Ninja does not do so




            This code segment compiles but I do not see how to replace the system used GUID see Red text below

            Code:
            #region Using declarations
            using System;
            using System.Collections.Generic;
            using System.ComponentModel;
            using System.ComponentModel.DataAnnotations;
            using System.Linq;
            using System.Text;
            using System.Threading.Tasks;
            using System.Windows;
            using System.Windows.Input;
            using System.Windows.Media;
            using System.Xml.Serialization;
            using NinjaTrader.Cbi;
            using NinjaTrader.Gui;
            using NinjaTrader.Gui.Chart;
            using NinjaTrader.Gui.SuperDom;
            using NinjaTrader.Gui.Tools;
            using NinjaTrader.Data;
            using NinjaTrader.NinjaScript;
            using NinjaTrader.Core.FloatingPoint;
            using NinjaTrader.NinjaScript.DrawingTools;
            #endregion
            
            //This namespace holds Indicators in this folder and is required. Do not change it.
            namespace NinjaTrader.NinjaScript.Indicators
            {
            public class MyCustomIndicator1 : Indicator
            {
            [COLOR=#e74c3c][B]private Guid myOCO_ID;[/B][/COLOR]
            protected override void OnStateChange()
            {
            if (State == State.SetDefaults)
            {
            Description = @"Enter the description for your new custom Indicator here.";
            Name = "MyCustomIndicator1";
            Calculate = Calculate.OnBarClose;
            IsOverlay = false;
            DisplayInDataBox = true;
            DrawOnPricePanel = true;
            DrawHorizontalGridLines = true;
            DrawVerticalGridLines = true;
            PaintPriceMarkers = true;
            ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
            //Disable this property if your indicator requires custom values that cumulate with each new market data event.
            //See Help Guide for additional information.
            IsSuspendedWhileInactive = true;
            }
            else if (State == State.Configure)
            {
            
            
            }
            }
            
            protected override void OnBarUpdate()
            {
            [COLOR=#e74c3c][B]myOCO_ID = Guid.NewGuid();[/B][/COLOR]
            
            }
            }
            }
            
            #region NinjaScript generated code. Neither change nor remove.
            
            namespace NinjaTrader.NinjaScript.Indicators
            {
            public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
            {
            private MyCustomIndicator1[] cacheMyCustomIndicator1;
            public MyCustomIndicator1 MyCustomIndicator1()
            {
            return MyCustomIndicator1(Input);
            }
            
            public MyCustomIndicator1 MyCustomIndicator1(ISeries<double> input)
            {
            if (cacheMyCustomIndicator1 != null)
            for (int idx = 0; idx < cacheMyCustomIndicator1.Length; idx++)
            if (cacheMyCustomIndicator1[idx] != null && cacheMyCustomIndicator1[idx].EqualsInput(input))
            return cacheMyCustomIndicator1[idx];
            return CacheIndicator<MyCustomIndicator1>(new MyCustomIndicator1(), input, ref cacheMyCustomIndicator1);
            }
            }
            }
            
            namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
            {
            public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
            {
            public Indicators.MyCustomIndicator1 MyCustomIndicator1()
            {
            return indicator.MyCustomIndicator1(Input);
            }
            
            public Indicators.MyCustomIndicator1 MyCustomIndicator1(ISeries<double> input )
            {
            return indicator.MyCustomIndicator1(input);
            }
            }
            }
            
            namespace NinjaTrader.NinjaScript.Strategies
            {
            public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
            {
            public Indicators.MyCustomIndicator1 MyCustomIndicator1()
            {
            return indicator.MyCustomIndicator1(Input);
            }
            
            public Indicators.MyCustomIndicator1 MyCustomIndicator1(ISeries<double> input )
            {
            return indicator.MyCustomIndicator1(input);
            }
            }
            }
            
            #endregion

            Comment


              #7
              Hello sgordet and BartMan,

              You can restore the items by renaming the database back to "NinjaTrader" and then rename the newly created database different than "NinjaTrader" (while NinjaTrader is shut down). The .sdf file named "NinjaTrader" is the database file that NinjaTrader will use. If there is no .sdf file named "NinjaTrader", a new database is created when you start NinjaTrader.

              Since the error persists with the new database, I suggest to restore your old database so you have access to your historical trade execution data.


              The error indicates the order uses the same OCO ID as previous orders. Do you disable 'OCO Order' from the right click menu after you submitted the orders? If not and you leave it enabled, then submit new entry orders, this error can happen.

              If you manually want to submit OCO orders, please always disable 'OCO Order' from the right click menu after you submitted them. Then if you want to submit new orders that are OCO, please enable 'OCO Order' from the right click menu again. Submit the orders you want to be OCO and then disable 'OCO Order' from the right click menu.

              Please note that you don't have to enable 'OCO Order' in the right click menu for ATM orders - they are already OCO. You should only use 'OCO Order' from the right click menu if you want to submit orders manually that are OCO.
              JasonNinjaTrader Customer Service

              Comment


                #8
                I did a rename. I ran into the same issue.


                Click image for larger version

Name:	CleanDB.png
Views:	283
Size:	17.5 KB
ID:	1199839


                Click image for larger version

Name:	PlaybackError.png
Views:	312
Size:	17.2 KB
ID:	1199840
                Attached Files

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by ageeholdings, Today, 07:43 AM
                0 responses
                6 views
                0 likes
                Last Post ageeholdings  
                Started by pibrew, Today, 06:37 AM
                0 responses
                4 views
                0 likes
                Last Post pibrew
                by pibrew
                 
                Started by rbeckmann05, Yesterday, 06:48 PM
                1 response
                14 views
                0 likes
                Last Post bltdavid  
                Started by llanqui, Today, 03:53 AM
                0 responses
                6 views
                0 likes
                Last Post llanqui
                by llanqui
                 
                Started by burtoninlondon, Today, 12:38 AM
                0 responses
                12 views
                0 likes
                Last Post burtoninlondon  
                Working...
                X