Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit and Renter Open Positions at the begining of a session

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

    Exit and Renter Open Positions at the begining of a session

    I have a strategy that involves carrying forward positions. In order to get unrealized PnL as a part of the output from the strategy run, I am closing and reopening positions at the begining of each session. Problem is the positions don't seem to be closing as I would expect. So i set up a simple test (see attached test strategy).


    But I notice that the total number of positions at the begining of each session seem to reflect that earlier positions were not closed. Please advice.


    thanks,
    Attached Files

    #2
    Seems like the reason maybe that the orders I am issuing under:

    Code:
    			if (Bars.FirstBarOfSession && CurrentBar > 0)
    			{
                    try
                    {
                        BeginSession();
                    }
                    catch (Exception e)
                    {
                        Print(e.Message);
                    }
    			}
    is coming back in Pending state...

    Additionally, I get the error:

    **NT** Error on calling 'OnOrderUpdate' method for strategy 'TestStrategy/f23ea5465b5e48acb8a439547ec9c9af': More than 100 subsequent user events
    Last edited by newworldguy; 05-24-2014, 09:37 AM.

    Comment


      #3
      Hello Newworldguy,

      The error message indicates that there are too many custom events in the same bar call. This is a safeguard for NS strategies to limit the # of potential user events per bar .

      You would need to further debug why so many events are being called at the same time.
      Cal H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X