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

Problem with my ExitShort

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

    Problem with my ExitShort

    hello, I am having an issue with my strategy that executes on every tick (CalculateOnBarClose=false) on a 100 tic chart.

    I execute my trade for 3 contracts with the following command EnterLong(tradeContracts, "") where tradeContracts is set to "3". This command works fine.

    I then sell my first contract with the command ExitShort(contractExit) with contractExit set to "1". This executes when I reach 5 tics. This command also works fine. I then sell my second contract with the same command ExitShort(contractExit) with contractExit set to "1". This executes when I reach 10 tics. This command is ignored!

    The second contract executes the same exit code as the first, so I know the code is syntactically correct since it worked for the first contract.

    Both of these exit commands occur in the same bar.

    Any insight or advice is greatly appreciated.

    #2
    Hello,

    What message comes up in the output window when this occurs? (tools -> output window)

    Have you verified the second exit is being called with a Print() ?

    While this may not apply to this situation please see the section Internal Order Handling Rules that Reduce Unwanted Positions
    for more information on why this might have been ignored: http://www.ninjatrader.com/support/h...d_approach.htm
    LanceNinjaTrader Customer Service

    Comment


      #3
      Thank you Lance. I tried several things and finally got it to work. Seems I needed to label my exits since they occur within the same bar. Once I did that, it worked like a charm. Hope this helps someone else with same issue.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by thumper57, Today, 04:30 PM
      0 responses
      3 views
      0 likes
      Last Post thumper57  
      Started by OllieFeraher, 05-09-2024, 11:14 AM
      5 responses
      16 views
      0 likes
      Last Post MisterTee  
      Started by jackiegils, Yesterday, 11:05 PM
      1 response
      11 views
      0 likes
      Last Post marcus2300  
      Started by Skifree, Today, 02:50 PM
      0 responses
      8 views
      0 likes
      Last Post Skifree
      by Skifree
       
      Started by owen5819, Today, 02:24 PM
      1 response
      12 views
      0 likes
      Last Post owen5819  
      Working...
      X