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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    152 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    89 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    131 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    127 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    107 views
    0 likes
    Last Post CarlTrading  
    Working...
    X