Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Resetting Sim Accounts Leaves Open Positions

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

    Resetting Sim Accounts Leaves Open Positions

    ok, I am trying to start fresh on my sim account.

    I have selected the options for the sim account, and hit reset.

    now when I go to the strategies tab, when I activate the strategies, they show existing positions. Most strategies show 1L. With a PL that is often a negative number.

    When I go to the Positions tab, however, there is nothing there. No open positions.

    I have clicked on Flatten everything various times, but to no avail.

    how do I create a truly fresh start?

    #2
    Hello,

    Thanks for the note.

    What you are seeing is the historical position of the strategy. Its the position the strategy would have been in if it had been running on historical. The strategy will always run on historical to get to the current bar.

    From what you describe it looks like your account position and the strategy position is not in sync.

    Strategy Position vs. Account Position:


    1st solution:

    You can include the following statement in your code to avoid the strategy to be calculated on historical data.

    // Only run on real-time data
    if (Historical)
    return;
    Add the statement to the top of OnBarUpdate()

    2nd solution:
    You can set 'On starting a real-time strategy' to 'Wait until flat before executing live'.
    This option can be found at Tools-->Options-->Strategies-->NinjaScript-tab.

    3rd solution, would be submitting manual orders to sync the strategy and account positions described in the link

    4th solution, would be to enable Sync account position to true.

    Comment


      #3
      2nd solution:
      You can set 'On starting a real-time strategy' to 'Wait until flat before executing live'.
      This option can be found at Tools-->Options-->Strategies-->NinjaScript-tab.
      If I use this solution, how long will it take till my strategies are ready to go? Will they have to be "in the yellow" for days on end before they are ready again?

      Comment


        #4
        // Only run on real-time data
        if (Historical)
        return;
        Add the statement to the top of OnBarUpdate()
        if I insert this line of code into my strategy, will I essentially nullify it for use in backtesting?

        Comment


          #5
          Hello,

          With option 2 you must wait for the strategy to be flat before it will start running live.

          With option 1 this would remove backtest option. However if you needed to backtest you could remove it. However not sure if your strategy needs historical data to enable and run correctly depending on how you have it coded.

          Let me know if I can be of further assistance.

          Comment


            #6
            what I dont get though, is why, when I reset the account, all current positons weren't just closed out. (disappear). I mean, its not a real holding; how hard can it be just to make it disappear.

            can I manually sell them, and then reset my account again to reset the P and Ls?

            Comment


              #7
              Hello,

              It is due to that reason. That position does not exist so there is nothing to reset. Your missing a key concept of how strategies work in NinjaTrader. NinjaTrader runs on historical data to get the current position. This is expected and there is no way to reset it.You would need to change how your strategy is coded to get results you are looking for.

              If you have any questions further on this please let me know.

              Comment


                #8
                is there any way to get strategies to only get me results for **what happens in the market from the moment I enable it, and going forward?***

                I mean, really. In real life, the strategy isnt going to go back to the open and buy the stock at the price that it was trading at at 10:15am. I want it to buy only going forward. Why is that so hard?

                Comment


                  #9
                  Hello,

                  This is exactly what this option will do for you:

                  You can set 'On starting a real-time strategy' to 'Wait until flat before executing live'.
                  This option can be found at Tools-->Options-->Strategies-->NinjaScript-tab.

                  Also, this option will also do this. Since your strategy is telling NinjaTrader it needs to be in a position and you missed the entry. You can setup sync to submit a syncing order to get your account to match your live position. However you live account entry can be different then your historical entry which is why a lot of people use the option above.


                  4th solution, would be to enable Sync account position to true.

                  http://www.ninjatrader.com/support/h..._positions.htm

                  Comment


                    #10
                    yeah, these are the options I have selected now.

                    Its a little weird how NT Thinks. When you fire a strategy up, and it is "yellow" (if you are in Wait until flat before executing live) , it is basically saying "hey man, there was an imaginary trade that you didnt take, that I would have taken, but didn't. So we're going to let that imaginary trade run its course. Once it is done, we will go green, and be ready for a new trade."

                    But if you are in "Immediately submit live working orders", when you fire up strategies, the machine is like "hey, I am going to go back in time and submit these orders for all these strategies at prices that are no longer available because this theoretically took place in the past. Oh, and by the way, now you have ten open orders, and you have to do money management for the positions you are now in, which you didnt actually opt into."

                    Comment


                      #11
                      Let me edit these for you:

                      ts a little weird how NT Thinks. When you fire a strategy up, and it is "yellow" (if you are in Wait until flat before executing live) , it is basically saying "hey man, there was an imaginary trade that you didnt take, that I would have taken, but didn't. So we're going to let that imaginary trade run its course. Once it is done, we will go green, and be ready for a new trade. The reason I do this is so that I do not try to exit a trade that I should be long. So that when the code you wrote tells me to exit the position I do a 1 short contract and this leaves your position with a bad 1 short position when you were wanting to be flat which then causes all sorts of account issues"

                      But if you are in "Immediately submit live working orders", when you fire up strategies, the machine is like "hey, I'm going to run exactly as I was programmed to do so. Currently I was long from yesterday and if today I needed to go flat I would then submit my order to close my current position. However be carefull as if you did not manually submit an order to make your account long 1 contract when I submit my 1 short contract to get our of my long position this is going to leave you with a short position on your account when I was just trying to go flat.

                      Finally your previous paragraph you were refering to the syncing option. This does not sync previous entries. It only syncs the current open trade if there is one.

                      -Brett

                      Comment


                        #12
                        fair enough. I think I'll stick to the first one, since the logic behind the second one seems very odd to me.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Gerik, Today, 09:40 AM
                        2 responses
                        6 views
                        0 likes
                        Last Post Gerik
                        by Gerik
                         
                        Started by RookieTrader, Today, 09:37 AM
                        2 responses
                        10 views
                        0 likes
                        Last Post RookieTrader  
                        Started by alifarahani, Today, 09:40 AM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by KennyK, 05-29-2017, 02:02 AM
                        3 responses
                        1,285 views
                        0 likes
                        Last Post NinjaTrader_Clayton  
                        Started by AttiM, 02-14-2024, 05:20 PM
                        11 responses
                        186 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X