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

Auto Trail Stop using NSEditor / Visual Studio

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

    Auto Trail Stop using NSEditor / Visual Studio

    Hi,

    Are there any examples of how to implement an auto-trail and breakeven stop using code?
    I'm looking for code examples that can be used so it can be back tested and optimized.
    (is it possible to backtest something like the scenario below using ATM?)
    Here's an example of what I'm looking to achieve:

    1. Enter a long trade as per my conditions.
    1a. Stop loss is set 10pips below entry point.
    2. Trade moves 20pips in my favour
    2a. Stop is automatically moved to breakeven
    3. Trade moves another 10 pips in my favour (+30 pips from trade entry)
    3a. Trailing Stop is activated and now trails the price by 10pips
    4. Trade moves against me by 10 pips
    4a. Trailing stop is triggered and trade is exited for 20 pips profit.

    Are there any examples showing how something like this can be implemented in code?
    I searched the forum but couldnt find many code examples.

    Thanks.
    Last edited by spook202; 02-15-2018, 07:27 AM.

    #2
    I managed to find a really good example in the NT8 strategy section from NinjaTrader_Paul:


    I managed to customize it to work with Pips and fills all of the requirements below. it's an excellent example and even draws the Profit Target / Trailing stop plots as well

    If you're reading this Ninjatrader_Paul, cheers

    Comment


      #3
      Hello spook202,
      Thanks for your post.

      I am happy that you found a good example for this and I let Paul know for you.

      Please let us know if you have any further questions.
      Josh G.NinjaTrader Customer Service

      Comment


        #4
        Hi --

        I have a similar question but the link that spook202 provided leads me to https://ninjatraderecosystem.com/user-app-share/.

        Can you share the strategy that NinjaTrader_Paul sent?

        Comment


          #5
          Hi jypark03, thanks for your question and welcome to the NinjaTrader forum.

          I have let Paul know of your question. He should be able to find the script that is linked.

          Thanks in advance for your patience.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Hello jypark03,

            The strategy is one that I converted from NT7, here is a link to the specific download: https://ninjatraderecosystem.com/use...lingstop_101b/
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Waxavi, Today, 02:10 AM
            0 responses
            6 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Started by TradeForge, Today, 02:09 AM
            0 responses
            11 views
            0 likes
            Last Post TradeForge  
            Started by Waxavi, Today, 02:00 AM
            0 responses
            2 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Started by elirion, Today, 01:36 AM
            0 responses
            4 views
            0 likes
            Last Post elirion
            by elirion
             
            Started by gentlebenthebear, Today, 01:30 AM
            0 responses
            5 views
            0 likes
            Last Post gentlebenthebear  
            Working...
            X