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:
    https://ninjatrader.com/support/help...crossabove.htm
    https://ninjatrader.com/support/help...crossbelow.htm

    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

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by aligator, Today, 02:38 PM
        0 responses
        5 views
        0 likes
        Last Post aligator  
        Started by Stett0002, Yesterday, 11:55 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by KasLB, Today, 05:12 AM
        2 responses
        17 views
        1 like
        Last Post KasLB
        by KasLB
         
        Started by LeitoGTR, Yesterday, 06:41 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by Prisalice, Today, 07:07 AM
        1 response
        10 views
        0 likes
        Last Post NT-Roland  
        Working...
        X