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

How to close a position without breaking the strategy

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

    How to close a position without breaking the strategy

    I built this strategy that places me in a position either short or long. It also sets my stop loss and profit target. Very kewl. If I choose to stop the order, all I need to do is click on the <Stop> button. However, it breaks the execution of the strategy.

    Is there a way I can add logic so that I can have a <Stop> button that get's me out of the situation?

    Thanks!

    #2
    Hello morrnel,

    Thanks for your post.

    You can add buttons to your strategy that can call ExitLong/ExitShort to close the strategy position from manual intervention. As the orders will be coming from the strategy, the strategy position will stay in sync with the account, and the strategy will not disable when the button is clicked

    Please see the example from our User App Share below for how you can add buttons to a strategy.

    https://ninjatraderecosystem.com/use...bar-buttons-2/

    For NinjaTrader 7, see below.

    This strategy will add buttons to the chart toolbar to sell or buy 1 lot but only when certain condition is true. By default the condition to buy is that Price has to close above the prior two bar. Anything can be changed in the script so each trader can define his own discretionary entry [&#8230;]


    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

    We look forward to assisting.
    Last edited by NinjaTrader_Jim; 07-14-2020, 02:39 PM.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by funk10101, Yesterday, 09:43 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
    5 responses
    551 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by rtwave, 04-12-2024, 09:30 AM
    5 responses
    37 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by funk10101, Today, 12:02 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by GLFX005, Today, 03:23 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X