Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Kate W.NinjaTrader Customer Service

    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:	135
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 jpapa, Today, 07:22 AM
          0 responses
          1 view
          0 likes
          Last Post jpapa
          by jpapa
           
          Started by Jltarrau, Today, 05:57 AM
          3 responses
          6 views
          0 likes
          Last Post Jltarrau  
          Started by f.saeidi, Today, 05:56 AM
          2 responses
          8 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Pattontje, Yesterday, 02:10 PM
          2 responses
          36 views
          0 likes
          Last Post Pattontje  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          7 responses
          27 views
          0 likes
          Last Post NinjaTrader_Erick  
          Working...
          X