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

Manage order after IB shutdown.

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

    Manage order after IB shutdown.


    Hello,

    We are running SampleOnOrderUpdate Strategy in realtime, and have noticed that realtime orders generated by the strategy are not listed in the Orders tab and this also happens for Executions associated to this strategy.
    We modified the strategy to remove StopLoss update on OnBarUpdate method, and then orders and executions were listed in their respective tabs. Why is that happening?

    Also, we noticed that running original SampleOnOrderUpdate Strategy (not modified version) on a chart, when a entry/exit/both positions are executed the labels ploted in the chart move along side the bar that is being drawn. Is that ok? Can you please explain how does the strategy works?

    Our main goal is to manage orders after Interactive Brokers has a weekly maintenance shutdown.

    #2
    Hello lismartin,

    Can you provide details on what specifically was changed with the sample? it sounds like you found the problem, so the solution would be to not use whatever modification was made. Without more details I couldn't really say what may have occurred there.

    Regarding the markers being drawn, I am not certain I understand the way you have worded the question. Are you asking if it is normal to see the executions move with the chart as it progresses forward in time?

    Managing orders across a weekly shutdown can be tricky depending on the logic you want to do in the strategy. Before going too far into this subject, I would suggest reviewing the platforms start behavior as that would be used if you plan to resume open orders or positions. To resume orders or positions, the strategy would need to be programmed with that in mind to accommodate the selected start behavior. https://ninjatrader.com/support/help..._positions.htm

    Not all strategies can resume orders or positions, depending on the specifics of the strategy it can in some cases conflict with a start behavior so this is a subject I suggest researching if that will specifically be a requirement. Otherwise it is generally suggested to pre-program the script to avoid the maintenance window by closing positions or trades it has prior to the maintenance so it can start again fresh.

    I look forward to being of further assistance.



    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse, thanks for your reply.

      We attached a screenshot of the method OnBarUpdate() which is the only method we modified in the strategy.

      Regarding the markers draw in the chart, is it normal to see the executions move with the chart as it progresses forward in time? Can you please explain how does the strategy works?

      Actually we use Adopt Account Position in my strategies because we run each strategy on different Simulation Account. Now we want to use several strategies on one account. Reading the documentation you suggested, apparently using Adopt Account Position start behavior isn't the best approach when running more than one strategy on the same account. What do you suggest to do?

      Thanks.

      Comment


        #4
        Hello lismartin,

        I tried commenting out the logic you have shown but see that the script still places trades. What are the specific steps you used to see the problem and what specifically do you see happen? Also when you say that the orders are not being listed, are you referring to the control center tab or what specific area are you looking at?

        Regarding the markers draw in the chart, is it normal to see the executions move with the chart as it progresses forward in time? Can you please explain how does the strategy works?
        It would be normal to see the execution placed on the bar where it happened, that bar won't be static and would move as new data comes in. Is this what you are seeing?
        This has nothing to do with how your strategy works but would relate to how the chart displays executions at a specific time. If you placed a execution at 12:00pm and are using a 1 minute series, you should see that execution push back toward the left of the chart every 1 minute bar that elapses. It would remain at 12 but would move as the chart progresses.

        Adopt Account position can only be used with a single strategy per instrument/account so that is not likely the best option for your goals. For this question I would only suggest to read the syncing account positions section, I personally cannot recommend one setting over the other. This will specifically relate to your goals and your specific strategy so you would need to pick the option that works best with the logic you make. I generally suggest walking through the steps of the behavior to see if that matches your goals. For example here is one of the common used options Immediately submit, synchronize account:

        • Any active orders on the account previously generated by the strategy that does not match* an active strategy order will be cancelled. Should the strategy be unable to cancel and receive confirmation on the cancellation of these orders within 40 seconds the strategy will not start and an alert will be issued.
        • The matching active orders on the account will then be mapped to the active strategy orders
        • Any remaining active strategy orders that cannot be successfully paired will be submitted live and the strategy will then try to sync your Account Position to your Strategy Position through the process below.

        Depending on your logic this may or may not work in all cases. Walking through the steps we can see the general action here would require that your script is able to re calculate the same orders historically: " Any active orders on the account previously generated by the strategy that does not match* an active strategy order will be cancelled." A previously generated order is considered to match an active strategy order when the order action, order type, quantity, limit price, and stop price are exactly identical. If the strategy is able to re calculate the same order when you re enable it, this setting could likely be used to resume existing orders or a position. If your strategy instead recalculates and makes different trades/positions you wont be able to resume the order/position by any automated means.

        This is often a subject you will need to perform tests with the logic you wrote to see what happens. Using the Playback connection can be helpful for this area.


        I look forward to being of further assistance.


        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by PaulMohn, Today, 03:49 AM
        0 responses
        6 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        10 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        3 views
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Working...
        X