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

SetTrailStop()

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

    SetTrailStop()

    Problem: On enter trade, initial stoploss set to 12 ticks. After a certain profilt is realized I would like to trail with a tighter stoploss, say 6 ticks. Can I do this with the SetTrailStop() in OnBarUpdate? If not, how would this be done? Thank you.

    #2
    imported post

    You can call SetTrailStop() in OnBarUpdate and amend an initial trail stop.

    Comment


      #3
      imported post

      Ok, next question, what's the best way to calculate, say, a 10 tick profit? At this point, when a 10 tick profit is reached, I want to set the trailing stop from 12 ticks, to 6 ticks. Do I set it up using the ATM functions? or is there a simpler way to test.

      Comment


        #4
        imported post

        See the Help Guide for information on the Position.GetProfitLoss() method.

        Ray
        RayNinjaTrader Customer Service

        Comment


          #5
          imported post

          Thanks. Got it. Ok, if I have the same strategy on Euro chart, and ER2 chart, does one affect the other? Meaning, do have to go down the Multi-time/Instrument road using BarsArray() or something?

          Comment


            #6
            imported post

            Not at all, just apply the same strategy to either chart. Thats it.

            Ray
            RayNinjaTrader Customer Service

            Comment


              #7
              imported post

              Ok, cool. I'm trying the NT 6 & Zen-Fire using CCI, the CCI calculations are not updating OnBarUpdate(), even though I initialized() with

              CalculateOnBarClose = false;

              What could this be?

              Comment


                #8
                imported post

                Do you want the calculations to occur once per bar or on each tick? If once per bar then:

                CalculateOnBarClose = true;

                Ray
                RayNinjaTrader Customer Service

                Comment


                  #9
                  imported post

                  Sorry, my mistake. I've been working on a strategy that calls a CCI indicator. My strategy was set to
                  CalculateOnBarClose =
                  false;



                  but the indicator was still stuck in the world of

                  CalculateOnBarClose = true;

                  this is how we learn, right...?

                  Thanks for your quick response

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Lumbeezl, 01-11-2022, 06:50 PM
                  31 responses
                  817 views
                  1 like
                  Last Post NinjaTrader_Adrian  
                  Started by xiinteractive, 04-09-2024, 08:08 AM
                  5 responses
                  14 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Started by swestendorf, Today, 11:14 AM
                  2 responses
                  6 views
                  0 likes
                  Last Post NinjaTrader_Kimberly  
                  Started by Mupulen, Today, 11:26 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post Mupulen
                  by Mupulen
                   
                  Started by Sparkyboy, Today, 10:57 AM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Working...
                  X