Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order not being submitted

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

    Order not being submitted

    Hi,

    Testing ninjascript by using NT(Simulated version) with IB forex live data.

    Have a simple strategy:
    protected override void Initialize()
    {
    ExitOnClose = false;
    CalculateOnBarClose = false;
    }

    protected override void OnBarUpdate()
    {
    EnterLongStop(QTY, UPPER, "");
    }

    UPPER=0.783
    Current price is 0.7797
    QTY=10,000

    When I run the strategy, the order does not get submitted. There is nothing shown in the Orders tab.
    However, the Strategies tab shows that the strategy is running, and the Unrealized column directly shows a net loss of -$33. It has calculated this loss value simply based on the current price, UPPER value and QTY, even without the order having been submitted and filled. This loss in the Unrealized column changes accordingly as the current price changes.

    It used to work fine an hour back, suddenly this problem has come up, where the order is not even being submitted.

    Thanks so much for your help.

    #2
    Just a follow-up to my previous post.

    I do not have any short position. I just want to do a Buy-Stop order, that's when I am having the problem described in the previous post.

    Without having any short position, does NT submit a Buy-Stop order when we use the EnterLongStop(...) method?

    Thank you.

    Comment


      #3
      JoeStein, yes you can use EnterLongStop to enter a long position by stop order. To check the order behavior of your strategy, TraceOrders are very helpful - http://www.ninjatrader-support.com/H...aceOrders.html

      Most likely you see the order expiring, as you do not resubmit it on the next bar or set it to liveUntilCancelled - http://www.ninjatrader-support.com/H...rLongStop.html

      For more info on Trace Orders, please see this tip - http://www.ninjatrader-support2.com/...ead.php?t=3627

      Comment


        #4
        Thank you. TraceOrders was helpful. But the problem continues.

        It first gave this message:
        Entered internal PlaceOrder() method at 5/25/2009 8:47:33 AM: Action=Buy OrderType=Market Quantity=0.01M LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
        5/25/2009 8:47:33 AM Ignored PlaceOrder() method at 5/25/2009 8:47:33 AM: Action=Buy OrderType=Market Quantity=0.01M LimitPrice=0 StopPrice=0 SignalName='Buy' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'

        EntriesPerDirection was 1. I changed it to 10.
        EntryHandling = AllEntries
        Also, modified the code to the following:
        protected override void OnBarUpdate()
        {
        //orderIssued is private bool

        if (! orderIssued) {
        EnterLong(QTY, "");
        orderIssued=true;
        }
        }

        Now, the output simply shows: 5/10/2009 8:40:00 PM Entered internal PlaceOrder() method at 5/10/2009 8:40:00 PM: Action=Buy OrderType=Market Quantity=0.01M LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''

        But there is no newly issued order shown in the Orders tab.

        Thanks in advance for your help.

        Comment


          #5
          JoeStein, from your code this is expected, since you're already long when you start your strategy up. Try adding a stop and a target which closes the long position. Then you should see new orders generated. For starting out it may be good to work with the provided SampleMACrossover strategy to learn how the auto trading framework behaves. For this it's also helpful to review this link - http://www.ninjatrader-support.com/H...tPosition.html

          Comment


            #6
            Thank you, the link was helpful indeed. So apparently my problem was because the strategy was first executing orders against the historical data that shows up in my chart.
            Is there anything I can insert in my strategy code to ensure that when the strategy starts off it could ignore the historical data and start executing orders only against live incoming prices?

            Secondly, when the strategy does execute "virtual orders" against historical data, is there any grid (like the Orders tab) where I can see the table of prices (trade history) of these "virtual orders" ?

            Thanks so much.

            Comment


              #7
              You can start your OnBarUpdate() with

              Code:
               
              if (Historical) return;
              for this - http://www.ninjatrader-support.com/H...istorical.html

              To see realtime and past performance includung execution and trade history, please right click on the active strategy in the 'Strategies tab' and select Strategy performance > Historical & Realtime.

              Comment


                #8
                Thank you.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, Yesterday, 10:06 AM
                0 responses
                20 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                18 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                14 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                9 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                38 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X