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

Trade Stop Management Script

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

    Trade Stop Management Script

    Hello,

    I have just built a strategy that is performing relatively well, but from looking at the periods of drawdown I noticed one thing I could improve on, however I do not know how I would program this in ninjascript.

    Basically my strategy is a counter trend strategy so it looses money when markets are trending hard. My strategy includes a stop loss and profit target. I would like my strategy to stop entering long trades after a long stop out, and stop entering short trades after a short stop.

    In other words, if my strategy enters a long position, two things can happen. It can reverse and go short or it can get stopped out. If it gets stopped out and the trend continues lower, it will continue buying and buying until the trend reverses. I don't want that risk.

    How would I program this?

    Any help would be GREATLY appreciated!

    Julian

    #2
    HI Julian,

    It sounds like you want to use the fill event from the stop order. This can be done with advanced handling and IOrder objects. Use OnExecution() handler to check fill state of the order.

    You could raise a bool flag when this order is filled, that is only reset at a time of your choosing, like maybe FirstBarOfSession or whenever you decide you want to trade again. The bool flag could be added to your entry condition.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    237 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    382 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    1 view
    0 likes
    Last Post oviejo
    by oviejo
     
    Started by pechtri, 06-22-2023, 02:31 AM
    10 responses
    125 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Working...
    X