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

Momentum Indicator Strategy

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

    Momentum Indicator Strategy

    Hello I am having some super trouble with the coding. I am using the built in momentum indicator on NT8. It has a 14 period signal and a zero line. I am trying to have a strategy enter a long position when the 14 line crosses above the zero line and stay in the long trade until either profit is met or the 14 period signal moves below the zero line. I cannot figure out how to make this work. I have tried to have the 14 line greater than zero enter trade but I cant get it to exit when signal crosses below and I only want it to enter once until next time is crosses above the zero line. Any help is much appreciated!

    #2
    Hello Ithinkimlost,

    Thanks for your post and welcome to the NinjaTrader forums!

    As this is your first post, I wanted to verify that you are using NinjaTrader and you are working directly in Ninjascript to create the strategy, or are you using the Strategy Builder?

    Regardless of scripting or Strategy Builder, are you using CrossAbove or CrossBelow methods?

    Reference:



    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Yes I am using NT8. and I am using the strategy builder. I was able to get it to work in one direction. I am curious is there a way to set a stop loss at a previous candle low? Thank you for your response.

      Comment


        #4
        Hello Ithinkimlost,

        Thanks for your reply.

        In the Strategy Builder you can use the profit and stops in the "Stops and Targets" window however these are fixed value only as they would be applied to every entry. So if you wanted x ticks stop and X tick profit on every order, these are what you would use.

        To use a "dynamic" stop loss, which is one that can be changed on every order, you can use other order methods found in the "Order management" folder of a set. When you use these type of orders (exception being market orders) you then have to use them for your stop as well as your profit target and cannot use the "Stops and Targets" methods as you would get strategy errors when running the strategy.

        To set a stop order at a previous bar low would require the following:
        At the time the entry order is placed, save the value of the previous bar low into a double type variable (assuming you want to continue to use that level) .
        In another set, you would check to see that the Market Position is long (Reference: https://ninjatrader.com/support/help...ionComparisons)
        In the same set, you would create the action to exit a long position by a stop order and provide the price of the variable
        In the same set, you would create the action to exit the long position by a limit order (this is the profit target) and you would need to provide your target exit price.
        NOTE: stop and limit type orders are automatically canceled if not filled on the same bar they are placed in, this is why you need to put these type of orders in their own set that is activated when you are in the market position.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          What was the way you found works for adding this to the builder? I am not able to see how to trigger a long with the line goes above 0.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by RookieTrader, Today, 09:37 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by kulwinder73, Today, 10:31 AM
          0 responses
          5 views
          0 likes
          Last Post kulwinder73  
          Started by terofs, Yesterday, 04:18 PM
          1 response
          23 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by CommonWhale, Today, 09:55 AM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Gerik, Today, 09:40 AM
          2 responses
          7 views
          0 likes
          Last Post Gerik
          by Gerik
           
          Working...
          X