Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Convert Stop to Trail or Cancel Stop-Loss

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

    Convert Stop to Trail or Cancel Stop-Loss

    I am trying to code a strategy which trades multiple positions, one with fixed profits, the other with no profit target but a trail stop. I tried using named entries and stops, but I find that the strategy works much better if I have fixed stops until the first profit is taken, then a trail stop after that. With named stops, I can assign a stop to one name and a trail to another, but results are improved, (based on manual inspection) if I have fixed stops initially and convert to a trail stop after the first profit is taken. Is it possible to cancel a stop programatically, or perhaps cancel it and replace it with a trail stop, once the first contract is taken off at a profit target? It appears that if I have an un-named stop, it will stop out all contracts, can I add a named trail stop to that mix, or will it be overridden by the fixed stop, as outlined in the help files?
    DaveN

    #2
    Hello daven,

    Thank you for your post.

    It would not be possible to convert a static stop to an auto trail. The AutoTrail must be set when the positioned is entered.

    What you could do is call an ATM Strategy where the profit trigger does not kick in the AutoTrail until a certain criteria has been met. This will ensure you're using the same stop loss for your order, but will not act as an auto trail until so many ticks in profit have been reached.

    Please review our Help Guide section on ATM Strategy Methods:


    Please let me know if you have additional questions.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Converting Stops

      I have already written a strategy that executes what you suggested, but backtesting it is extraordinarily time-consuming, (though it can certainly be argued that the results of this kind of backtesting are far more useful than the standard backtesting). I just want to clarify your answer, there is no way to programatically cancel a stop loss once it is programatically executed in a strategy, is that correct?
      DaveN

      Comment


        #4
        daven,

        Correct - you cannot "Unset" the SetStopLoss and reset to SetAutoTrail. SetStopLoss and SetAutoTrail cannot be used together. You'd need to use SetStopLoss only and then code the trail part of this as needed.

        If you need to cancel the initial stop, you can use ExitOrders and IOrders to resubmit a 2nd stop loss as as AutoTrail when the condition has been met. However, this will not be the same stop loss and would need to resubmit a second order with the auto trail set on this order.

        More information on using IOrder can be found below:

        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by timmbbo, Today, 08:59 AM
        0 responses
        1 view
        0 likes
        Last Post timmbbo
        by timmbbo
         
        Started by bmartz, 03-12-2024, 06:12 AM
        5 responses
        33 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by Aviram Y, Today, 05:29 AM
        4 responses
        14 views
        0 likes
        Last Post Aviram Y  
        Started by algospoke, 04-17-2024, 06:40 PM
        3 responses
        28 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by gentlebenthebear, Today, 01:30 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X