Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop -Move Stop to Break Even - Trail Stop

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

    Stop -Move Stop to Break Even - Trail Stop

    Hi,

    example: Is it possible to program a stop of 50 on an entry, and if the entry moves in the correct direction and it it is in a profit of 50, move the stop to 1, and then have the stop trail at 50?

    Thank you.

    #2
    Hello KentLaw,
    You cannot use SetStopLoss and SetTrailStop for the same order.

    The SetTrailStop() method can NOT be used concurrently with the SetStopLoss() method for the same position, if both methods are called for the same position (fromEntrySignal) the SetStopLoss() will always take precedence. You can however, use both methods in the same strategy if they reference different signal names.


    However you can use the SetStopLoss method to submit the order and then reassign it again via custom coding and change it. This way you can simulate the trial stop.

    Please refer to this sample code which further demonstrates it.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Is there anybody here knows how to get the number of contracts in a current position? How to know if the stop1 or stop2 is still active?

      Comment


        #4
        Hello luxurious_04,
        You can use the Position.Quantity to determine the current position quantity. Please refer to our help guide to know more about it.


        If you are submitting the stop orders using the Exit() methods then you can assign an IOrder object to it and check if they are filled or not.

        Code:
        IOrder ord = ExitLongStop(Close[0] - 10 * TickSize, "MyLongEntry");
        if (ord.Filled > 0)
        	Print("Stop order filled/part filled);
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by timmbbo, Today, 08:59 AM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by KennyK, 05-29-2017, 02:02 AM
        2 responses
        1,279 views
        0 likes
        Last Post marcus2300  
        Started by fernandobr, Today, 09:11 AM
        0 responses
        0 views
        0 likes
        Last Post fernandobr  
        Started by itrader46, Today, 09:04 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by bmartz, 03-12-2024, 06:12 AM
        5 responses
        33 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Working...
        X