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

Setup a trail stop in wizard strategy

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

    Setup a trail stop in wizard strategy

    Hello,

    In my strategy, I want to setup a trail stop when my position is in positive for example a 0.90% percent since the entry and put the trail stop in a 0.10%

    How I can put the trail stop when is in positive?


    Thanks and regards.

    #2
    Hello ziquillo,
    Thanks for posting today.

    You can use the GetProfitLoss() method to determine your current profit or loss for the current position.

    Here is a link to the GetProfitLoss() method documentation from the online help guide. http://ninjatrader.com/support/helpG...profitloss.htm

    Then when the specific condition is met you can use the SetTrailStop() to set your trailing stop at that point.

    Here is a link to SetTrailStop() method documentation from the online help guide. http://ninjatrader.com/support/helpG...ttrailstop.htm

    Please let us know if we may be of further assistance for anything NinjaTrader.
    Alex G.NinjaTrader Customer Service

    Comment


      #3
      Thanks Alex,

      But how I can use GetProfitLoss and SetTrailStop in wizard strategies?

      Is there some example without touch the code directly?



      Thanks and regards.

      Comment


        #4
        Hello ziquillo,
        Thanks for the reply.

        This will not be able to be done within the strategy wizard.

        The strategy wizard applies profit targets, trailing stops, and stop losses only to the Initialize method and this would not allow you to set the trailing stop based on a conditional statement within the OnBarUpdate.

        However, you could use the strategy wizard to set most of your conditions and then unlock the code to manually move the trailing stop to a conditional statement based on your unrealized PnL.

        Please let us know if we may be of further assistance for anything NinjaTrader.
        Alex G.NinjaTrader Customer Service

        Comment


          #5
          trailing stop

          looks like this in view code is this correct for after entry long or short that the stop market order will trail by 7 ticks for every price move of 1 new tick

          protected override void Initialize()
          {
          SetTrailStop("NewTrendwithMOMO", CalculationMode.Ticks, 7, false);

          CalculateOnBarClose = true;
          }

          /// <summary>
          /// Called on each bar update event (incoming tick)
          /// </summary>
          protected override void OnBarUpdate()

          Comment


            #6
            Hello RicRules,

            Yes, based your example, each new entry named "NewTrendwithMOMO" will have a 7 tick trailing stop.
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rbeckmann05, Today, 06:48 PM
            0 responses
            4 views
            0 likes
            Last Post rbeckmann05  
            Started by rhyminkevin, Today, 04:58 PM
            4 responses
            52 views
            0 likes
            Last Post dp8282
            by dp8282
             
            Started by iceman2018, Today, 05:07 PM
            0 responses
            5 views
            0 likes
            Last Post iceman2018  
            Started by lightsun47, Today, 03:51 PM
            0 responses
            8 views
            0 likes
            Last Post lightsun47  
            Started by 00nevest, Today, 02:27 PM
            1 response
            14 views
            0 likes
            Last Post 00nevest  
            Working...
            X