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

How to programmatically override a TrailStop in unfavorable market conditions...

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

    How to programmatically override a TrailStop in unfavorable market conditions...

    Hello awesome NinjaTrader gurus!

    I am attempting to fine-tune the usage of 'TrailStop()', and while reviewing the trades my strategy is creating I have noticed several horrible trail stops being inserted near daily market openings shortly after 9:30 am.

    Generally my TrailStops are working well and get me out of a ton of problems but in conditions where the equity experiences a sharp drop in pre-market hours the trailstop will trigger right at market open and internalize my losses at the worst possible time...

    What I would like to do in these situations is have the opportunity to review the circumstances of a trailing stop being created and pro grammatically cancel it if market conditions are bad. (In that situation I'd ask the code to cancel the ill-advised trail stop, leave the position open, and send me an email so that I can manually close that losing position in better market conditions (e.g. later in the day)

    Is there an override function that can notify me of a position that is about to be closed so that I can cancel 'bad closes' and avoid horrible morning losses?

    Thanks for the awesomeness!

    Jean-Pierre

    #2
    Hello Jean-Pierre,

    You cannot cancel a trail stop.

    But if you wanted to use exit orders with trailing logic and cancel those, that would be fine.

    Below is a link to an example.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Awesome ChelseaB,

      So if I understand correctly I can do what I need to do by 1) not using trail stops and 2) instead using the 'trailing logic' example you pointed to?

      If so most awesome! I'll be studying this example in depth

      Comment


        #4
        Hello JPPoulin,

        Absolutely. A trail stop is just a stop market that is modified with logic to trail tick for tick. You could do that too.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you again very much ChelseaB for the heads up. I was able to study how the ProfitChaseStopTrailExitOrdersExample_NT8.zip (4.0 KB, 1 view) sample works and was able to replace my immutable stop loss for its programmatic equivalent (that can be easily modified as needed) so that I can prevent exiting a position at the worst possible time.

          Reading that example makes me realize that strategy development is much more complex than I anticipated.
          Q1: Is there a good tutorial that teaches a developer how to code a good strategy?
          Q2: What is the most polished code example that demonstrates a well-designed (usable) strategy?

          Thanks again

          Comment


            #6
            Hello JPPoulin,

            For our resources we put reference samples in the help guide and we have the tutorials in the help guide.

            (edit, I should have put a link in here)



            This thread will remain open for any community members that would like to provide you with their personal favorite guides.

            I also may not be the best to ask for an opinion of what is the best polished usable strategy. Our support is more here to solve specific issues. The broader sense of what to do is more of a question for the community or other traders.

            You might look through the User App Share and see if anything there interests you.



            The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
            Last edited by NinjaTrader_ChelseaB; 07-02-2019, 02:04 PM.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello ChelseaB,

              Thanks for the help, I'll review the user app share area and hopefully will find something good.

              I'd love the hear about some guides or some strategies that provide source code from the community if possible!

              Thanks again

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by PaulMohn, Today, 03:49 AM
              0 responses
              6 views
              0 likes
              Last Post PaulMohn  
              Started by inanazsocial, Today, 01:15 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jason  
              Started by rocketman7, Today, 02:12 AM
              0 responses
              10 views
              0 likes
              Last Post rocketman7  
              Started by dustydbayer, Today, 01:59 AM
              0 responses
              4 views
              0 likes
              Last Post dustydbayer  
              Started by trilliantrader, 04-18-2024, 08:16 AM
              5 responses
              23 views
              0 likes
              Last Post trilliantrader  
              Working...
              X