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

Is there a way to attach a limit order to an indicator in strategy builder

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

    Is there a way to attach a limit order to an indicator in strategy builder

    Hello,

    I was wondering if there is a way to attach a pending limit order to an indicators value in strategy builder so the order will be filled once price touches the indicator value? I have tried to use EnterLong or EnterLongLimit, which results in either a delayed entry, or a poorly filled order since the order is usually filled at Close, next bar Open, etc... I would like the pending limit order to be filled the instant price interacts with the indicator value, without having to place a limit order and move manually to follow the indicator. I know this can be done in DOM, but I would like it automated.

    Thank You,
    Chris

    #2
    Hello chrisca,

    Thank you for your note.

    Yes, you could have your strategy work a limit order at an indicator value which will fill the moment the price trades that level. I have attached a screen shot of how you’d set this up through the strategy analyzer.

    With the set up in the screen shot, on every bar there will be a limit order working at the 14 period SMA.

    If you wanted this order to update on each tick, you would want to run the strategy with calculate set to OnEachTick.

    The reason why when you apply the strategy to a chart, and look historically and see that the price fills on the next bar has to do with a lack of intraday data. This would not be the case in real time. The solution to the fill being on the next bar historically would be to add a secondary tick series, which would require working outside the strategy builder. I have provided a link below which contains more information.
    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the reply.

      Given what your screen shot shows though, wouldn't a limit order be triggered if price hit the SMA, but would not be filled until price came back into contact a second time? I am looking for a way to have a pending limit order placed in advance so an order would fill once price came into contact with the indicator the first time.

      Thank you,
      Chris

      Comment


        #4
        Hello Chris,

        If you'll notice from the screen shot, there is no condition, no if statement. Instead just an action defined, that action being submit a limit order at the SMA.

        I might suggest setting up the limit order call as I did, defining a profit target and stop loss, then applying the strategy to a chart and connecting to the simulated data feed. This will demonstrate how this works in real time.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Thank you Alan!

          So what you are saying is that the order will be placed at said indicator value ahead of time since no conditions are predefined, and when price touched said indicator, the order will fill. Then all I need to do is assign a target price and stop loss, correct?

          Thanks again,
          Chris

          Comment


            #6
            Hello chrisca,

            Correct.

            Please let us know if you need further assistance.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Ok, so for some reason my NT is giving me a message when I try to open the strategy builder stating that "NinjaScript must be in a compilable state to create or edit strategies. Please use NinjaScript Editor to resolve compilation issues." Any idea how to fix this?

              Thanks,
              Chris

              Comment


                #8
                Any help with this issue would be appreciated.

                Thank you,
                Chris

                Comment


                  #9
                  Ok so I got the strategy to run, but the pending limit orders become stuck (orange) while running in sim. This also happens while attaching a limit order to an indicator without using a strategy. Any ideas on correcting this issue from happening in the future? This makes the strategy unstable and unable to use with live orders.

                  Thank you,
                  Chris

                  Comment


                    #10
                    Hello Chris,

                    Could you please send an email to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and attach the log and trace files for the day in subject which you can find in My Documents>NinjaTrader8>Log and My Documents>NinjaTrader8/Trace folders.

                    Please include the time exactly the issue occurred.

                    I look forward to your email.
                    Alan P.NinjaTrader Customer Service

                    Comment


                      #11
                      Ok will do. I lost track of what time it was on, so I am running it again until it gets stuck and I will send the files over. Also, I would like to attach an order to each indicator I am using. I am using 3 different Bollinger Bands and would like an order attached to each, yet the strategy will only apply an order to one of them. Is there any way to fix this?

                      Thank you again,
                      Chris

                      Comment


                        #12
                        Hello chrisca,

                        Thank you for writing in.

                        I would suggest adding print statements to check whether and when your conditions are becoming true. I’ve provided a link to a youtube video which covers an example of using prints to understand behavior:

                        Dive into manipulating C# code from within an unlocked NinjaScript strategy using the NinjaScript Editor.NinjaTrader 7 is an award winning end to end online ...


                        I’ve provided a link covering debugging which you may find helpful.
                        Debugging: http://ninjatrader.com/support/forum...ead.php?t=3418

                        If after attempting above, you'd like to send a copy of the strategy you’re running, I can take a look and see if anything jumps out.

                        To export a NinjaScript from NinjaTrader 8 do the following:
                        From the Control Center window select Tools -> Export -> NinjaScript...
                        Click Add>Select the indicator>OK>Export.
                        Then attach that file you saved; under My Docs>NT8>Bin>Custom>Select the downloaded .zip file.

                        Please let us know if you need further assistance.
                        Alan P.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by rtwave, 04-12-2024, 09:30 AM
                        2 responses
                        19 views
                        0 likes
                        Last Post rtwave
                        by rtwave
                         
                        Started by tsantospinto, 04-12-2024, 07:04 PM
                        5 responses
                        67 views
                        0 likes
                        Last Post tsantospinto  
                        Started by cre8able, Today, 03:20 PM
                        0 responses
                        6 views
                        0 likes
                        Last Post cre8able  
                        Started by Fran888, 02-16-2024, 10:48 AM
                        3 responses
                        49 views
                        0 likes
                        Last Post Sam2515
                        by Sam2515
                         
                        Started by martin70, 03-24-2023, 04:58 AM
                        15 responses
                        115 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Working...
                        X