Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

¿how can i liquidate all positions before the close on friday?

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

    #16
    Hello rtwave,

    Thank you for your reply.

    The log and trace files I'd need would be under Documents > NinjaTrader 8 > log and Documents > NinjaTrader 8 > trace. They're listed by date, so 3 days or so would probably be sufficient to review.

    Thanks in advance; I look forward to assisting you further.

    Comment


      #17



      Kate, people with nt,


      i have done as requested and sent numerous log and trace files inside one zip file. hopefully that will be of any help regarding all of this situation.

      Comment


        #18


        i have a quick update to make regarding this subject.


        i didn't have access to market data 3 weeks ago, so i was unable to evaluate this particular code on the friday, 8th of november. however, i had 3 strategies trading automated on the last two fridays, the 15th and 22th of november, and this block of code performed magnificently at the close of those sessions:


        Click image for larger version

Name:	20191127 liquidate all positions friday 001.JPG
Views:	170
Size:	106.8 KB
ID:	1079190


        the code is working as intended, it has liquidated all positions on 4 of 5 fridays i have had the chance to have it running automated and nt's simulator engine has performed excellently. i consider that the inconsistent performance that i had experienced with this code must be solved by now. as an aside, i have missed the opening of markets on the past two sundays so i don't know for sure if the variation of this block of code i created to reestablish positions is also working as it should. if there are any other significant developments i will report them but for now i consider this block of code to be performing as intended.

        very well, thanks, regards.

        Comment


          #19



          people with nt,



          i think i have solved this issue.


          i have several strategies that would be supposed to liquidate all positions on friday before the close but when running optimizations it became evident that these strategies were not doing that.


          after devoting a lot of time to this matter and after a lot of trial and error, i have now managed to have my strategies operate as intended.


          i have multiple types of entries in my strategies and i realized that every time i declared the conditions for exits i had to include a command to liquidate a position for every possible type of entry. something like the following:

          Code:
          conditions for liquidation on friday before the close
          {
          ExitShort(Convert.ToInt32(positionsize), @"exit02shortposition01", @"shortposition01");
          ExitShort(Convert.ToInt32(positionsize), @"exit02shortposition02", @"shortposition02");
          }

          the nt platform is a stickler when it comes to the signal names for entries and exits when one is using unique entries, now that i know that i have managed to make exits at specific times work. if the people with nt were not aware of this, they would do well to add this to their documentation.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          81 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          42 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          64 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          66 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          54 views
          0 likes
          Last Post CarlTrading  
          Working...
          X