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

Strategy condition to enter a trade when an indicator changes direction

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

    Strategy condition to enter a trade when an indicator changes direction

    Perhaps it's already answered, but I didn't see it, but I am looking to code a strategy builder with a condition to enter long when an indicator changes direction from down to up, and vice versa for a short. So if the indicator's current value > prior value , and the prior value < prior value two bars ago, this is a change in direction from negative to positive. Does something exist to call this out and how is this best applied to the strategy builder? Thank you

    #2
    Hello Binarytrader,

    Thank you for your post.

    Yes, that is a fairly simple thing to create in the Strategy Builder. You will need two sets of conditions, one to trigger the short trades, and one to trigger the long. I've put together a simple example strategy using the SMA indicator, however, you could modify this to use the indicator of your choice.

    Here is a basic guideline of how to import and view this strategy in NinjaTrader 8:

    To Import:
    1. Download the attached file to your desktop, keep it in the compressed .zip file.
    2. From the Control Center window select the menu Tools &gt; Import &gt; NinjaScript Add-on...
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.
    Critical - It will prompt that you are running newer versions of @ SMA and ask if you want to replace, press 'No'

    Once complete, you can view the strategy in the Strategy Builder by opening a new Strategy Builder window and selecting the ExampleChangeDirection strategy from the dropdown.

    Here's a link to our help guide regarding building conditions in the Strategy Builder:
    https://ninjatrader.com/support/help...on_builder.htm

    Please let us know if we may be of further assistance to you.
    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you Kate. This is perfect!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by LawrenHom, Today, 10:45 PM
      0 responses
      3 views
      0 likes
      Last Post LawrenHom  
      Started by love2code2trade, Yesterday, 01:45 PM
      4 responses
      28 views
      0 likes
      Last Post love2code2trade  
      Started by funk10101, Today, 09:43 PM
      0 responses
      7 views
      0 likes
      Last Post funk10101  
      Started by pkefal, 04-11-2024, 07:39 AM
      11 responses
      37 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Yesterday, 08:51 AM
      8 responses
      44 views
      0 likes
      Last Post bill2023  
      Working...
      X