• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Link pending order to indicator value

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

    Link pending order to indicator value

    Hello,

    Is there any way to link a pending limit order to the value of an indicator so the order will move with the indicator and be filled once price crosses the indicator value?

    Thank you in advance,
    Chris

    #2
    Hello,

    Thank you for posting.

    With NinjaTrader 7 you can utilize a Strategy for this type of logic. This would entail the platform trades for you rather than allowing you to manually submit orders and then attach them to an indicator. Going forward with NT8, there is a more complex alert system which would allow you to attach orders to indicators. In addition, you can still create strategies that also do this.

    I look forward to being of further assistance
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply Jesse.

      I am currently using NT 7, but can switch to 8 if needed. Is there any chance you could point me in the direction on MY 7 that would allow me to accomplish this? I have went though every single part of the wizard, and have scoured the internet with no success. I assume you can't accomplish this type of strategy through the wizard and would require custom code, correct?

      Comment


        #4
        Hello chrisca,

        Thanks for writing in to our Support team.

        There is no way to link a pending order to an indicator value - in order to submit an order when the price crosses an indicator value, you can set the following condition in the strategy builder:

        Price data - Close with bars ago of 0
        Select CrossAbove or CrossBelow from the drop down list
        Select and indicator value to use from the Indicators list
        Click OK

        Then, for your action, chose Enter long/short position.

        You may review these sample images in which I have set up my strategy to submit a buy makret order when the price crosses above the 8 period ADX.

        Please let me know if I may be of any further assistance.
        Attached Files
        Last edited by NinjaTrader_AlanS; 06-19-2017, 08:45 AM.
        Alan S.NinjaTrader Customer Service

        Comment


          #5
          I know it's possible to link an order to an indicator on NT 8, and the way you have your ADX crossover setup is the way I have had mine set up, as well as many others. Every one of them places an order on the next bar instead of the moment the interaction with an indicator takes place. Every setting I've been told to use (with the exception of custom order coding) has not worked. I know that an add on feature in NT 8 allows this. Is there code I can find that I can take from NT 8 to NT 7 to achieve similar results?

          Comment


            #6
            Hello chrisca,

            Thanks for your reply.

            You will need to de-select the Calculate on bar close setting while setting up your strategy through the builder in order for it to be calculating on each tick and not wait until the close of the bar to run its logic. Note that this setting will be respected and submit orders when the event occurs when running the strategy in real-time but not while backtesting the strategy on historical data.

            Please let me know if I may be of any further assistance.
            Alan S.NinjaTrader Customer Service

            Comment


              #7
              So here is the issue I am having. Price moved down toward the lower Bollinger Band,but did not touch or cross it. A few seconds later however, when price reversed on the same candle causing the Bollinger Band to contract, pulling the low of the candle wick thru the BB, the order filled, causing a poor fill towards the median. I only want an order to fill if price crosses the BB, and not if a price reversal causes the BB to be crossed, if that makes any sense. So technically, the candlestick never had a move great enough to cross the BB. Is there a way to stop an order from being filled if price contraction cause the BB to be crossed by price, and only if a price extreme forces a cross?

              Here is my code so far. If you could review and let me know where, if any, my issues are, please let me know.

              I know what I am asking is difficult and confusing, so any help at all would be greatly appreciated.

              Thanks again,
              Chris
              Attached Files
              Last edited by chrisca; 06-20-2017, 04:37 PM.

              Comment


                #8
                Hello chrisca,

                Thanks for your reply.

                You can modify your code to include if(FirstTickOfBar) before your order entry logic to ensure that your strategy can still calculate values intra-bar but will only run your order entry logic when the bar is closed.

                You can find more information on FirstTickOfBar here:
                http://ninjatrader.com/support/helpG...ttickofbar.htm

                Alternatively, if you want to prevent your orders from being submitted based on intra-bar events you will have to select Calculate on Bar Close when creating the strategy so that the strategy logic only runs at the close of the bar rather than on each incoming tick. Please keep in mind that this would prevent all of your code from running until the close of the bar.

                Please let me know if I may be of any further assistance.
                Alan S.NinjaTrader Customer Service

                Comment


                  #9
                  I do want to run the strategy on each tick since I want the order to be filled the instant price touches or crosses the Bollinger Band. Would the first tick of bar allow this to happen and have an order fill when price crosses the BB, but not if price reverses, thus pulling the Bollinger Band into contact with the bar wick?

                  Comment


                    #10
                    Hello chrisca,

                    Can you clarify - do you want to submit a limit order when the price crosses below the Bollinger Band value and then cancel that order if the band pulls back into contact with the bar wick? Or are you interested in submitting a market order once the bar has closed and if price has crossed the Bollinger Band value?

                    I look forward to your reply.
                    Alan S.NinjaTrader Customer Service

                    Comment


                      #11
                      Sorry for the confusion. I want to place a buy limit order when price crosses the lower BB. The problem I'm having is that if price doesn't quit cross the BB, and then reverses leaving a wick, the BB will compress, causing the BB to touch the lower wick of the candle, thus triggering an order too late. I want the order to trigger if price expands to the BB and not if price brings the BB in for a late fill. The initial burst is what I'm looking for.

                      Comment


                        #12
                        Hello chrisca,

                        Thank you for the clarification.

                        If you want the order to be submitted exactly when the price touches the lower Bollinger Band Value, then you should not use CrossBelow as a comparison, as CrossBelow will check for a cross below condition over a specified bar look back period. Instead, you should set your condition up as:

                        if(Close[0] <= Bollinger(3, 20).Lower)
                        EnterLongLimit()

                        I have included some images attached to this post that demonstrate how to set up this condition in the strategy builder.

                        Please let me know if I may be of any further assistance.
                        Attached Files
                        Alan S.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by BatBart, Today, 01:24 PM
                        1 response
                        19 views
                        0 likes
                        Last Post NinjaTrader_Melissa  
                        Started by ezrakoper, Today, 03:05 PM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Started by asmmbillah, Today, 02:23 PM
                        1 response
                        16 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by steveg, Today, 02:44 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_Heath  
                        Started by lightsun47, Today, 12:33 PM
                        1 response
                        13 views
                        0 likes
                        Last Post NinjaTrader_Jim  
                        Working...
                        X