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

How to handle entry order on the last bar of the day?Historical/Realtime?

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

    How to handle entry order on the last bar of the day?Historical/Realtime?

    Hi,
    The "issue" below is not really an issue, I am just not sure how to handle it, due to real-time/historical change in logic. I need some of your help.

    When a strategy enters into a trade (for example: enter long) in the last bar of the trading session, there is an "issue" the following day, when I disable and enable the strategy.
    The issue is that I close the ninjatrader, there is a night time, then I open the ninjatrader in the morning, then I enable the strategy before the market opens.
    But the strategy is sending another "enter long" order, the moment I enable the strategy.

    It is not clear what happens when I enable the strategy before the market session. Is it historical? realtime? how does the transition happen? on the first tick?

    My strategy logic was supposed to assume that when I enable the strategy, the last bar of the previous day will be calculated as historical (enter the trade historically),
    and when the next bar open (at market open), it will transition into real-time logic and then will continue the strategy.

    From my prints, it shows that when I enable the strategy, the enterlong command comes from historical logic. But if it comes from historical logic, why it sends to the trading platform a real buy order?

    Looking forward to your help,
    Thank you!

    #2
    Hello zoharcho,

    The order may be automatically cancelled and resubmitted, depending on the Start behavior and whether that order was matched.

    Below is a link to a forum post on resuming a strategy after disabling and re-enabling.


    When enabling a strategy at any time, any data loaded before the current moment is now historical data.

    Orders are submitted in real-time when using Immediately Submit and there is no order matching a live historical order.

    From the help guide:
    "Any remaining active strategy orders that cannot be successfully paired will be submitted live and the strategy will begin managing your Strategy Position assuming your Account Position is in sync with it."
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you, I will go over it, understand it better.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by RideMe, 04-07-2024, 04:54 PM
      5 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by f.saeidi, Today, 08:13 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by DavidHP, Today, 07:56 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by kujista, Today, 06:23 AM
      3 responses
      10 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by Mindset, Yesterday, 02:04 AM
      2 responses
      18 views
      0 likes
      Last Post NinjaTrader_RyanS  
      Working...
      X