• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close all positions for the chart's symbol

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

    Close all positions for the chart's symbol

    Hello,
    what is the correct instruction to run on a NinjaTrader7 script to close all positions of the same symbol of the current Chart regardless of whether they were launched manually or with a strategy? Those of the actual account with the broker (or Market Replay if I am connected to it)
    So if the Chart is ES 12-19 I want to close any open position ES 12-19 regardless of whom - or how they were opened it.

    Similarly what's the best way to know if I have any open positions of the same symbol of my chart ES 12-19, those of the actual account with the broker (or Market Replay if I am connected to it).

    And similarly what's the best way to cancel any order for the same symbol of my chart ES 12-19, those of the actual account with the broker.

    Thank you.
    Giogio
    Last edited by giogio1; 11-11-2019, 12:55 AM.

    #2
    Hello giogio1,

    Thank you for your note.

    If you're not looking to do this programatically, just hitting the Close button in any chart will result in all pending orders being canceled and all existing positions being closed on the account/instrument combination that is selected. Any running strategies will be stopped and their positions exited and pending orders cancelled.

    If you're looking to do this from NinjaScript, unfortunately that would not be supported in NinjaTrader 7. You would also not be able to detect manual orders on the account from within a strategy in a supported manner. However, NinjaTrader 8 would support this.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      You cannot flatten all positions (manual and strategy) of a single symbol in NinjaTrader 7.

      You can, however, flatten everything, regardless of symbol and mode of creation.

      --==0==--

      How to "Flatten Everything"?

      Manually, from Control Center menu,
      CC -> Files -> Flatten Everything

      Manually, from Positions Tab,
      Right click on position, select Flatten Everything from context menu

      Programmatically, try this,
      https://ninjatrader.com/support/foru...inate-strategy

      Also, you can try this,
      https://ninjatrader.com/support/foru...ks?postcount=6

      Lastly, study these,
      https://www.google.com/search?q=ninj...hing+from+code


      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by abdullah, 11-15-2017, 08:44 PM
      10 responses
      819 views
      0 likes
      Last Post Lancer
      by Lancer
       
      Started by brunoviveiros, Today, 04:31 AM
      2 responses
      13 views
      0 likes
      Last Post brunoviveiros  
      Started by foxy_rav, Today, 06:31 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by neilzep, Today, 06:42 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by teafortwo, Today, 04:26 AM
      3 responses
      8 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Working...
      X