Announcement

Collapse
No announcement yet.

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:



    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.

        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 NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          62 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          134 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X