Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Which method is more reliable for Flatten all at close?

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

    Which method is more reliable for Flatten all at close?

    Hi Ninjas,

    I'm aware there are 3 ways to flatten positions at close and cancelling all active orders, here:

    1. Provided by NT :

    Tools--> Options--> Misc--> Check box Flatten all

    2. NT Statement that is called as following:

    Code:
    protected override void Initialize()
            { 
    		ExitOnClose = true;
        		ExitOnCloseSeconds = 5;
            }
    3. Coded by you in the Strategy, something like:

    Code:
    if ( Bars.BarsSinceSession < BarsRequired || ( ToTime(Time[0]) >= 165950 && ToTime(Time[0] ) <= 171456 ) )							
    			{							
    				ExitLong();						
    				ExitShort();								
    				return;										
    			}
    My question: In your practical experience through years, which one is more reliable ?

    Thanks

    #2
    Hello pstrusi,

    Thank you for your post.

    Flatten All, flattens everything on the account. If you wanted it to just go through the strategy then you can use ExitOnClose or your own code.

    Comment


      #3
      I imagine that it doesn't matter if your Strategy is working under unmanaged order, I mean: If ExitOnClose=True, Will NT Flatten All with market orders, right?
      Last edited by pstrusi; 10-05-2015, 10:43 AM.

      Comment


        #4
        Hello pstrusi,

        Correct, Flatten All would use market orders no matter if you use Managed or Unmanaged.

        Comment


          #5
          Silly question:

          If you have in your script ExitOnClose=True, BUT when you enable this strategy from a chart for example, and you set in the option of ExitOnClose=False, then:

          1. Would it still NT close all positions, right?

          Comment


            #6
            Originally posted by pstrusi View Post
            Silly question:

            If you have in your script ExitOnClose=True, BUT when you enable this strategy from a chart for example, and you set in the option of ExitOnClose=False, then:

            1. Would it still NT close all positions, right?
            Which has priority depends on where you have the statement in the script. If in Initialize(), the PropertyGrid takes priority, otherwise the code does, and you will see it override whatever is in the PropertyGrid.

            Comment


              #7
              Thanks Koganam for your answer, now I know these priorities. I really didn't know that ExitOnClose=True could be stated in any place outside of Initialize() method in the script and even more had priority to override whatever its in the grid.

              Suggestion for NT member support: Please consider to add in the help guide what Koganam said.

              Comment


                #8
                Originally posted by pstrusi View Post
                Thanks Koganam for your answer, now I know these priorities. I really didn't know that ExitOnClose=True could be stated in any place outside of Initialize() method in the script and even more had priority to override whatever its in the grid.

                Suggestion for NT member support: Please consider to add in the help guide what Koganam said.
                I may have misspoken. It is not so much a matter of priority as it is a matter of when the property directive is last processed.

                Comment


                  #9
                  Hello pstrusi,

                  Thank you for your response.

                  I will forward your suggestion to our development team.

                  Comment


                    #10
                    Another question:

                    Let's imagine that due to previous connection loss, the Strategy position left out of sync of my Account position ( from my broker's account ) , when either ExitOnClose or Flatten All are called , what will NT do? Flatten according to the Strategy or Account Position ? Would it be there some potential risk to remain in my broker's account with a position at close ?

                    Comment


                      #11
                      Originally posted by pstrusi View Post
                      Another question:

                      Let's imagine that due to previous connection loss, the Strategy position left out of sync of my Account position ( from my broker's account ) , when either ExitOnClose or Flatten All are called , what will NT do? Flatten according to the Strategy or Account Position ? Would it be there some potential risk to remain in my broker's account with a position at close ?
                      That is why you should not start your autotrader, then walk away to play golf, though if you can afford to play golf, maybe you can take any loss.

                      Do not let NT run with your strategy position out of sync with your account position. Be there to manually correct it if necessary!

                      ref: http://ninjatrader.com/support/forum...16&postcount=1


                      Read the entire very long threads, please, so you can get the context.
                      Last edited by koganam; 09-28-2017, 10:05 AM. Reason: Corrected grammar.

                      Comment


                        #12
                        Thanks Koganam, as always I appreciate your help, I'll read them all.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by jxs_xrj, 01-12-2020, 09:49 AM
                        4 responses
                        3,282 views
                        1 like
                        Last Post jgualdronc  
                        Started by Option Whisperer, Today, 09:55 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post Option Whisperer  
                        Started by geddyisodin, 04-25-2024, 05:20 AM
                        8 responses
                        58 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by halgo_boulder, 04-20-2024, 08:44 AM
                        2 responses
                        22 views
                        0 likes
                        Last Post halgo_boulder  
                        Started by mishhh, 05-25-2010, 08:54 AM
                        19 responses
                        6,189 views
                        0 likes
                        Last Post rene69851  
                        Working...
                        X