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

Running Simulated and Live Strategies Simultaneously

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

    Running Simulated and Live Strategies Simultaneously

    I was running the same strategy on the same instrument with both my Sim101 and live trading account simultaneously and it caused major synchronization issues. Exit signals were generated simultaneously, but NT only executed the exit on my Sim account -- leaving my live position open. Luckily, I noticed the discrepancy when I saw my strategy position exited (flat) on the chart, but I had the Positions tab open in the control center and saw that it was not flat. There was a mismatch. So I checked my brokerage account and saw that the live position was indeed still open and I quickly closed it manually. I checked the Log for order information and only saw the exit order for Sim101. I disabled both strategies and tried to get back to synchronized state using various strategy start behaviors, but when I did this, it opened a live position in the opposite direction as if it was an attempt to flatten the unsynchronized position. After crossing the spread several times trying to synchronize I had to give up due to the transaction costs I was incurring.

    I have several other strategy positions open on other instruments concurrently, so I'm worried that if I restart NT8 I will run into the same sync issue again.

    I have a screenshot showing both Sim and live accounts "fighting" to synchronize my position on the same chart. I'd prefer to share the image via message if needed. I don't think Sim and live accounts should be connected in any way regardless of strategy start behavior, but the image clearly shows they are connected somehow. Can you please advise on how we can resolve this?


    Also, here's what I was referencing with start behavior. It mentions multiple strategies on a single account but does not mention running strategies on the same instrument in different accounts (sim101 and live). Again, the issue arose when Sim101 seemingly "beat" my live account in the message pump to exit a position.

    Note: Please be aware that these options will only help you sync your Account Position to your Strategy Position once on startup. These options will not guarantee your Account Position remains in sync afterward. Any active orders you may have had on your account prior to strategy start that was not generated by your strategy would not have been cancelled on start and can lead to your Account Position being out of sync from your Strategy Position. Placing manual trades or running multiple strategies on the same instrument can also lead to your Account Position being out of sync from your Strategy Position.

    https://ninjatrader.com/support/help...rtbehavior.htm

    #2
    Hello jflaggs,

    Thanks for your post.

    Please write in to support[at]ninjatrader[dot]com with a brief description of your inquiry, the screenshot you mentioned, and follow the steps below to attach your Log and Trace files to your email so we may look into this matter further.

    In the subject of your email include "Attn: BrandonH" and in the body of your email include a link to this forum thread.

    Follow the steps below to manually attach your log and trace files to your response so I may investigate this matter further.
    • Open your NinjaTrader folder under, "Documents" (sometimes called, "My Documents")
    • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
    • Send the 2 compressed folders as attachments to this email.
    • Once complete, you can delete these compressed folders.
    I look forward to assisting further.​
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Good morning. What was the resolution for this? I am having the same issues.

      Comment


        #4
        Hello joedtrades1982,

        Thanks for your notes.

        To clarify, are you running one strategy on the Sim101 account and the other strategy on a live account or Demo account?

        Or, are both strategy instances running on the same account and same instrument?

        What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)​

        Have you added debugging prints to the script to understand how the strategy is behaving?

        In the strategy, add prints to the script (one line above the condition) that print out all the values being used for your Exit order condition along with the Time of the bar. Also, print out the order object in OnOrderUpdate() to see how the order is evaluating.

        OnOrderUpdate(): https://ninjatrader.com/support/help...rderupdate.htm

        Below is a link to a forum post that demonstrates how to use prints to understand behavior.
        https://ninjatrader.com/support/foru...121#post791121
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        4 responses
        3,281 views
        1 like
        Last Post jgualdronc  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        5 views
        0 likes
        Last Post Option Whisperer  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        58 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        22 views
        0 likes
        Last Post halgo_boulder  
        Started by mishhh, 05-25-2010, 08:54 AM
        19 responses
        6,189 views
        0 likes
        Last Post rene69851  
        Working...
        X