Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

syncing strategy position with acct position

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

    syncing strategy position with acct position

    Has anyone come up with a way that you don't have to sync up the initial strategy position with the account position by hand. For example if I am trading with an SMA crossover when I turn the strategy on if it enters me into a strategy position when the next cross occurs where I would then be put into a live account position because of the previous strategy position, it is not synced together. I am trading such a large number of rules that this makes it impossible to do by hand and also seems grossly inefficient and to me takes the whole point of automated trading away.
    thanks
    p.

    #2
    pistolpete,

    You will always need to sync the strategy. What you can try is to use the "Wait until flat before executing live" option in Tools->Options->Strategies->NinjaScript. Even with this though you need to make sure you are flat in account position and then the strategy will kick in either when it is flat or when a crossover occurs. If you are flat in account before starting strategy this option will sync it up for you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      pistolpete,

      You will always need to sync the strategy. What you can try is to use the "Wait until flat before executing live" option in Tools->Options->Strategies->NinjaScript. Even with this though you need to make sure you are flat in account position and then the strategy will kick in either when it is flat or when a crossover occurs. If you are flat in account before starting strategy this option will sync it up for you.
      I clicked on Wait until flat before executing live, I ran 8 new positions in the simulated live account with the exact same rule. When I turned it on, the strategy position was zero but some of them where showing an unrealized gain/loss even though I didn't hold a strategy position. Does it show an unrealized gain/loss because I had already traded that stock during the day? When I turned it on the account position is flat and it shows the strategy position as '-' but eventually when one of them engaged the rest of them all fired strategy positions, why is that? All I want to do is have the sma crossover turn on and fire automatically when the cross occurs. I have no idea why this is so complicated for this system.

      Comment


        #4
        Not sure I follow. Just run one strategy at a time and you will see how it behaves.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Strategies do not match positions

          Originally posted by NinjaTrader_Josh View Post
          Not sure I follow. Just run one strategy at a time and you will see how it behaves.
          Josh,

          not sure if this is the same issue. I am doing some final testing.

          1. I am using the sim101

          2. zenfire and latest NT.

          3. I am looking at my strategies screen from under CC and i have 4 positions live (on sim) with unrealized P&L for each position. So it says I am Long 4 cars total.

          4. I then go to the Positions tab, and I am only seeing 3 positions?

          How can this be? What is my noob brain missing. This does not seem right.

          Oh, also, when I use the market analyzer and look to see P&L both unrealized and realized it does not reflect what is showing under strategies tab in CC.

          Anxious to get live so a prompt reply is appreciated.

          Thank you in advance,

          Comment


            #6
            r2kTrader,

            Please post a screenshot of the tabs you are looking at. Thank you.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Josh,

              I checked my Log and it shows me order for YM, ES, NQ, but not for TF. But my strategy shows me all 4 (with 1 car each).

              So could it be possible that my strategy is showing me what "would" have happened, but for some reason TF didn't fire a "real" order? Is it something to do with the TF contract?

              Just some thoughts. I found it strange that I am showing orders for YM, ES, NQ, but not TF, and this coincides with my strategy tab showing 4 cars with P&L and 3 cars unter the position tab.


              Thanks,

              Comment


                #8
                r2kTrader,

                Not sure. Please use TraceOrders = true and see what is going on internally in your strategy.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  I am just using the SMA crossover strategy that comes with NT.

                  The strategies stopped for the day, but you can see 2 attached files showing weird behavior.

                  One shows the tab with all strategies stopped, the other with all strategies started. As you can see, there is no position, but I am showing an Unrealized loss/profit???

                  Also, I am set to be flat before entry or whatever that setting is.

                  Getting one's head wrapped around this strategy behavior is a real son of a gun. Not fun at all. Why can't it just "work"? Seems way to complicated.

                  Anyway, just frustrated. I want to use real money, but it seems like every time I turn around, something else pops up. Then to address questions becomes writing an essay. I can't just pick up the phone and ask someone. It's quite frustrating...

                  Ok, so anyway, links to understand Strategy behavior = helpful.

                  Explain why I can show unrealized profit/loss when no position on = helpful.

                  Explain how I could have positions showing under strategies tab on control panel, but not show a corresponding order under Positions = helpful.

                  Frustrated,
                  Attached Files

                  Comment


                    #10
                    r2kTrader,

                    I believe the Positions column in there shows you real, live positions and not strategy position. The unrealized is coming from the virtual strategy position. You can check the strategy's true position by having it print out its position. You will find it has a strategy position as you ran those strategies.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      r2k,
                      I understand your frustration I have been there many times myself. Even though NT is a great system there still seems to be some fundamental flaws that hopefully will be ironed out as NT progresses. Let me get this straight, for the most part you are running strategies that are showing strategy positions but not real positions? So what you want to see happen is that as your parameters are met then NT would take the position automatically? Both in the strategies tab as well as the positions tab? Is it taking positions in the strategies tab but not in the positions tab? It is taking one strategy position but not exiting the position?

                      Comment


                        #12
                        Okay guys. Let us take a step back and simplify things. Use one instance of SampleMACrossOver on one instrument. As you start it up it will calculate a strategy position.

                        Please use TraceOrders = true to really print out what the strategy position is. Also, compare it against the Positions tab in the CC.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Pistolpete,

                          Essentially what you just said. I don't want to see virtual anything. I want to see what is actually happening. Not virtual! (yes, this is quite maddening).

                          If I have a strategy running, I don't want it to virtualize anything. If a trigger is hit, then take the trade. If it is NOT hit, then stay the heck flat. Seems pretty straight forward to me, lol, but what do I know...

                          Josh, got it. Simplify the equation. Fine, so if I set it to TraceOrders = true, will that only show me real trades and not virtual? Or will it just spit it out the debug/output window or in a log?

                          I want to give live and I need to know what to expect. I don't want to think I am up or down on a strategy and be counting my profits or losses that are not even really there?

                          So please, is there a step by step breakdown of the whole darned thing so a layman can know what to expect.

                          I will continue to remain patient as I burn day after day and hour after hour trying to understand things which seemingly should just "work", lol. Sorry Josh, but I am no computer noob and have developed a software program or two in my time. While some aspects are intuitive, some are just bizzare and unorthodox. I am sure it made sense at the time, but some things sure as heck don't make sense now. Kudos to you and the team though, I can' say I would be able to do it better. I'm just frustrated and feel like I am wasting so much time with this. It would seem easier to just execut discipline at this point verses trying to autotrade ;-)

                          I just want it to "work". If I have an contract on, tell me and let me know if I am up or down. Virtual? Lol, I can't spend virtual at the 7-11. I tried, they wouldn't accept my demo account!!

                          Standing by,

                          Comment


                            #14
                            r2kTrader,

                            What it sounds like you are trying to do may have a very simple solution. Add this to the top of your OnBarUpate() method.
                            Code:
                            if (Historical)
                                 return;
                            That will effectively ignore all historical bars and not calculate out a virtual strategy position. From that point forward anything it does will be live. All you need to do is ensure your account position is also flat as you start up and then everything will be in line.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Josh,

                              This should resolve the real vs virtual, thanks.

                              So if I see a position under strategy, there should be a position under positions tab as well to correlate with said?

                              Also, any suggestions for how to flush the existing orders/positions for an underlying before running the strategy? e.g. If I fire up a strategy on ES, I want to get 100% flat and take any existing orders off on ES before strategy runs. Must this be done manually? Can't this be done programmatically? (if that's a word :-)

                              Also, when you say it will disregard historical bars, does that mean in regards to min bars required? So if I do that, will I have to wait for (say I am set to 20 bars required) 20 bars to go off live first before taking a position? If so, this is critical to know.

                              Regards,




                              Originally posted by NinjaTrader_Josh View Post
                              r2kTrader,

                              What it sounds like you are trying to do may have a very simple solution. Add this to the top of your OnBarUpate() method.
                              Code:
                              if (Historical)
                                   return;
                              That will effectively ignore all historical bars and not calculate out a virtual strategy position. From that point forward anything it does will be live. All you need to do is ensure your account position is also flat as you start up and then everything will be in line.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by DerkWehler, Today, 11:35 AM
                              9 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by dbennett3, Today, 01:59 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post dbennett3  
                              Started by webus, Today, 06:22 AM
                              4 responses
                              18 views
                              0 likes
                              Last Post webus
                              by webus
                               
                              Started by DayTradingDEMON, 07-11-2024, 08:54 AM
                              16 responses
                              48 views
                              0 likes
                              Last Post DayTradingDEMON  
                              Started by DawnTreader, 05-08-2024, 05:58 PM
                              41 responses
                              279 views
                              0 likes
                              Last Post DawnTreader  
                              Working...
                              X