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

exit position - new entry

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

    exit position - new entry

    Hello,

    I have in my script Exitshort() before doing the enterlong when conditions are true. But there are more short positions closed than have been in the trade. Thats strange and cant find the reason.In the attached screenshot one can see that the short rS1a and rS1b from a trade and they are closed with Buy-To-Cover and Close Position. Where might this Close Position come from, is this maybe by default from NinjaTrader before doing a trade in the other direction?

    Thank you!
    Tony​
    Attached Files
    Last edited by tonynt; 01-24-2024, 04:31 PM. Reason: translation error

    #2
    Hello tonynt,

    Thank you for your post.

    In the Unmanaged Approach, an Enter() method in the opposite direction will automatically reverse the position. The internal order handling rules attempt to prevent the unwanted position you have described, though the rules do not apply to market orders, such as ExitShort() and ExitLong(). In your script, you can remove the ExitShort() and the new entry will result in two orders - one to close the short position and another to enter the long position. This is noted in the help guide here:
    • https://ninjatrader.com/support/help...d_approach.htm
      • "Entry() methods will reverse the position automatically. For example if you are in a 1 contract long position and now call EnterShort() -> you will see 2 executions, one to close the prior long position and the other to get you into the desired 1 contract short position."
    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rhyminkevin, Today, 04:58 PM
    3 responses
    47 views
    0 likes
    Last Post Anfedport  
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    7 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    50 views
    0 likes
    Last Post futtrader  
    Working...
    X