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 helpwanted, Today, 03:06 AM
        0 responses
        3 views
        0 likes
        Last Post helpwanted  
        Started by Brevo, Today, 01:45 AM
        0 responses
        6 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X