Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Historical Order Processing

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

    Historical Order Processing

    Hi,
    I need to place a historical order at some certain point, for example
    CurrentBar = Bars.Count - 5

    I increase the number of days to 1000, set MaximumBarsLookBack to "Infinite" and use this condition for the historical processing
    protected override void OnBarUpdate()
    {
    if(Historical)
    {
    if(CurrentBar == Bars.Count - 500)
    {
    EnterLong();
    }
    }
    }

    It doesnt take the historical position. Is there any other property I need to set to make this work?
    Thanks

    #2
    Hello Iondonwala,

    Thank you for your post and welcome to the forums!

    I tested the logic our and it does appear to work on my end.

    Can you please add TraceOrders = true; to your Initialize() method and open Tools -> Output window and run the strategy?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Output is
      26/03/2015 19:38:00 Entered internal PlaceOrder() method at 26/03/2015 19:38:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''

      Strategy is not showing any position. Also Data Series Value is 1 Minute time frame bars.

      I also have tried to use

      if(Time[0].Year == 2015 && Time[0].Month == 03 && Time[0].Day == 25 &&
      Time[0].Hour == 10 && Time[0].Minute == 0)
      {
      EnterLong();
      }

      It doesnt work either.

      Comment


        #4
        Iondonwala,

        Are you running this strategy from the Strategies Tab or Chart?

        If the strategy is in a historical position it will not show on the Strategies tab of the Control Center. This will only show live positions. You can view the strategy performance of the strategy to see where the order was entered in at.

        Right click on the strategy -> Strategy performance -> Historical
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          It is working now. I set Exit on Close = false.
          Many Thanks,

          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