Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Position vs. Account Position

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

    Strategy Position vs. Account Position

    Reference the post of the same title in the 'Tips' section, where a mismatch occurs because the Strategy is started part way through a session. The solution to the problem is given as - manually enter an account position to make it match the strat position.
    This is very messy and if at the time you can see that the strat position is near to exiting you would not want to enter. Are there any plans to clear up this problem programatically? A method would be nice, could be called EnterHistoricalPositions(false) or true of course.

    #2
    DaveS,

    You can already do that.

    Code:
    if (Historical)
         return;
    Then your strategy will not calculate until the first real-time bar.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Wow Josh, were you watching me type? You replied in about 10 seconds

      Thanks
      Dave

      Comment


        #4
        Note Dave. This is not to say just not place historical trades. This really influences when your strategy starts processing.

        If your strategy would be in a certain state if it did calculate historical data points, this same state would not necessarily be achieved as you neglect historical data and just start from a blank state with if (Historical) return;.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Yes, I see, if the whole of OnBarUpdate() was prevented from running that way. But presumably it can be used elsewhere, e.g.

          if ('some logic or other' && !Historical)
          EnterLong(..

          Comment


            #6
            Doesn't necessarily help. EntriesPerDirection limits you from entering in certain cases. If you don't have a position because you are preventing it from entering historically it may take a position where it would have ignored otherwise.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Don't really understand what you mean. If the strat is allowed to run and accumulate data, why does it matter if the historical trades don't occur? Any indicators present will still get their initialising data, am I missing something?

              Comment


                #8
                Dave,

                There can be cases where it does matter. It is a chicken-egg situation. Many strategies prevent entering additional trades if they already held a position. If you prevent all historical processing you will not hold a position and when the next condition comes you would place in a trade which may have otherwise been ignored by the original strategy.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Yes, I think I see what you mean. My code has prevented any historical entries but would have held a position otherwise, (strategy position only, not account). So when real time data arrives and yields a signal, an entry occurs which would have been prevented by the strat position, had there been one. It is a bit difficult to talk about, isn't it.
                  I will take care to avoid that situation.

                  Thanks fo your help Josh.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  558 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  324 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  545 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  547 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X