Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    580 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    335 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    102 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X