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

Moving from a SetStopLoss to SetTrailStop

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

    Moving from a SetStopLoss to SetTrailStop

    Hello NT Support,

    I'm developing a strategy that is looking to catch large intraday moves. When entering a trade, I have a SetStopLoss at a reasonable level and a goal price with SetProfitTarget (typically, many points away). After the trade moves enough in my favor, I would like cancel the SetStopLoss and then use SetTrailStop so that some profits are locked in but still allow the trade to "breathe" to make larger profit moves.

    I'm not seeing any means to do this. The CancelOrder routine needs an order but the SetStopLoss routine doesn't return any Order object.

    If I'm understanding correctly and am able to cancel the SetStopLoss order, I would need to do the following:
    1. Cancel SetStopLoss order
      1. NOTE: Because of the OCO connection, the SetTargetPrice order is automatically cancelled, too.
    2. Call SetTrailStop AND call SetTargetPrice at the same level I had before.
    I'm using these method calls, so I'm connecting the order with the fromEntrySignal.
    SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool isSimulatedStop)
    SetProfitTarget(string fromEntrySignal, CalculationMode mode, double value, bool isMIT)


    Is this possible?

    Thanks!
    Matt

    #2
    Hello StealthM93,

    The Set method orders cannot be cancelled, you would need to use the other order methods like ExitLongStopMarket so you have an order object that can be used with CancelOrder.

    Alternatively you would just not cancel the order and add logic in OnBarUpdate to call SetStopLoss to update its price, you can create a trailing stop with SetStopLoss by calling it each time you want to change its price.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello NinjaTrader_Jesse,

      Thank you for the quick response. I'm aware that I could code a trailing stop and update SetStopLoss as appropriate, but I'm looking to avoid coding that logic. However, I didn't think about using Exit_StopMarket order instead of SetStopLoss. I'll look at that.

      Thanks!
      Matt

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by pibrew, Today, 06:37 AM
      0 responses
      4 views
      0 likes
      Last Post pibrew
      by pibrew
       
      Started by rbeckmann05, Yesterday, 06:48 PM
      1 response
      14 views
      0 likes
      Last Post bltdavid  
      Started by llanqui, Today, 03:53 AM
      0 responses
      6 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by burtoninlondon, Today, 12:38 AM
      0 responses
      12 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      16 views
      0 likes
      Last Post AaronKoRn  
      Working...
      X