Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder Problem

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

    IOrder Problem

    I'm running a simple strategy on market replay and i have a problem with the IOrder object.

    when i use the folowing my order IS filled:

    private IOrder entryOrder = null;
    ...
    protected override void OnBarUpdate()
    {
    EnterLong(DefaultQuantity, "");

    when i use the folowing my order IS NOT filled:

    private IOrder entryOrder = null;
    ...
    protected override void OnBarUpdate()
    {
    entryOrder = EnterLong(DefaultQuantity, "");


    Please help

    #2
    Change it to

    it (entryOrder == null) entryOrder = EnterLong(DefaultQuantity, "");

    Comment


      #3
      Originally posted by Radical View Post
      Change it to

      it (entryOrder == null) entryOrder = EnterLong(DefaultQuantity, "");
      I wasn't about to test that tonight....

      But I definitely felt concerned without the help example being followed.

      But I could see his concern... It should at least fill once?...

      Comment


        #4
        I managed to solve the problem. I changed my settings to "Immediately submit live working historical orders".

        Is there a way to close all open positions and clear all open orders at the beginning of the strategy?
        Attached Files
        Last edited by kiss987; 09-05-2012, 01:08 AM.

        Comment


          #5
          Hello kiss987,
          You are having a position in the historical bars and thus NinjaTrader is waiting for the strategy to go flat.

          Yellow highlighted "Strategy" cell indicates the strategy is waiting until it reaches a flat position to be in sync with the account position before fully starting.


          If you do not want to use the Immediately submit live working historical orders, then you can also write the below code which will calculate the strategy on historical bars.

          Code:
          protected override void OnBarUpdate()
          {
            if (Historical) return;
             //rest of the codes
          
          }
          Please let me know if I can assist you any further.
          JoydeepNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X