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

Why can I not close out partial positions?

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

    Why can I not close out partial positions?

    Hello,

    I'm having great difficulty trying to completely close Long OR Short positions that have previously had part of the position closed out. I seem to be only able to close positions that have the same number of units as had been originally entered when the trade was opened.

    For example if I'm trying to close a max. of 3 open Long positions using the following code it will not work if part of the positions have been previously exited:

    if(Position.MarketPosition == MarketPosition.Long)
    {

    ExitLong("TRADE HI1");
    ExitLong(
    "TRADE HI2");
    ExitLong(
    "TRADE HI3");
    }

    I was under the impression that "ExitLong/ExitShort" was supposed to completely close a position regardless of how many units remain from the original opening...but this seems not the case...how am I supposed to close these "partial" positions??? Thank you.

    #2
    Hi Burga1,

    If you want to scale out of a position, you must first scale in, as in this sample - http://www.ninjatrader.com/support/f...ead.php?t=3751
    TimNinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply and info.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by algospoke, 04-17-2024, 06:40 PM
      3 responses
      26 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by bmartz, 03-12-2024, 06:12 AM
      3 responses
      28 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Started by Aviram Y, Today, 05:29 AM
      2 responses
      9 views
      0 likes
      Last Post Aviram Y  
      Started by gentlebenthebear, Today, 01:30 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by cls71, Today, 04:45 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X