• 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

Order Entry at specific level

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

    Order Entry at specific level

    Hello community,

    first of all thanks for the great support here!

    I have a question: Is it possible to create a program that enters a trade at a specific level? For example the FDAX-level I made is 9450. If the price comes from above across this level, I have to enter a short trade. If it comes from the bottom across the level, I have to go long!

    How do I develop kind of this strategy?

    Thanks in advance.

    #2
    Hello arroganzmaschine,

    Yes, this is possible to create an automated strategy that will do this. You may check the previous bar to see if the previous price was to see if it came from above or below this.

    Using the Strategy Wizard, you may view our Help Guide at the following link that goes over "How to make a price data comparisons" for the Bars Ago to check.
    http://www.ninjatrader.com/support/h...on_builder.htm

    Note that if you want to define a price to which you want to compare to you may define a "User defined Variable" that you can compare the price to.

    Otherwise, if you are manually coding this here is few good example of using the brackets "[]" to compare the bars ago values.
    http://www.ninjatrader.com/support/f...ad.php?t=19346

    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      I don't want the specific price level as an parameter in the strategy. For example I draw a horizontal line. Can the strategy identify it and send orders, if the line is crossed? And how?

      Comment


        #4
        Hello arroganzmaschine,

        Yes, this can be done in NinjaScript but this would require some custom coding and cannot be done in NinjaScript,

        To get the values of manually drawn lines, you may want to view the code for the "LineAlert" indicator that does this for reference which grabs the drawing objects in a chart.
        http://www.ninjatrader.com/support/f...d=4&linkid=472

        Happy to be of further assistance.
        JCNinjaTrader Customer Service

        Comment


          #5
          Thank you! I will try it. How do I code it and what do I have to code? Not a NinjaScript? What else?

          Comment


            #6
            Hello arroganzmaschine,

            Not sure, what mean exactly. It would still be a NinjaScript file that you would need to create for this automated strategy but it will need to be manually coded meaning that when you go to Tools -> New NinjaScript -> Strategy and input some of the basics of your strategy you will have to press the "Unlock Code" button at the bottom.

            This will allow you to write code manually inside of the strategy which would be needed to get the price of the lines that you are drawing.

            Let me know if this answers your question.
            JCNinjaTrader Customer Service

            Comment


              #7
              Yes, that was the information I at least needed. Are there any examples of C#-Code for NinjaScript that I can work with? Any good idea how to handle such a problem?

              Comment


                #8
                Hello arroganzmaschine,

                Including the one I previously sent you there are many other different examples that you may view at the following link as well.

                http://www.ninjatrader.com/support/f...ead.php?t=3220

                Feel free to download and import them on to your machine to get familiar.

                Let us know if you have any questions.
                JCNinjaTrader Customer Service

                Comment


                  #9
                  Hi, one question. The hotkeys in the active window with chart trader don't work. Is this in connection to the demo-account? Or did I do something wrong?

                  Comment


                    #10
                    Hello arroganzmaschine,

                    Can you make sure that under the Tools -> Options that "Use order entry hotkey" is checked if you want to place orders using the Hotkey feature?
                    JCNinjaTrader Customer Service

                    Comment


                      #11
                      Thank you! That was my Problem. One other question: Can I get the value of a horizontal line in the Chart for my strategy? I mean with c# Code.

                      Comment


                        #12
                        Hello arroganzmaschine,

                        Yes, if you view post #4 I have linked a Indicator called "LineAlert" that checked for UserDrawn lines that gets the Y values for an alert.

                        You may use this same concept inside of a Strategy.
                        JCNinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_JC View Post
                          Hello arroganzmaschine,

                          Yes, if you view post #4 I have linked a Indicator called "LineAlert" that checked for UserDrawn lines that gets the Y values for an alert.

                          You may use this same concept inside of a Strategy.
                          The LineAlert contains an if-clause with "crossAbove" or "CrossBelow". Can I change it and write there an "EnterLong(1, "");"? And how do I import it, if I can change it?

                          Comment


                            #14
                            Hello arroganzmaschine,

                            You would not want to change the "LineAlert" Script but you may use its logic. For example:

                            Code:
                            protected override void OnBarUpdate()
                                    {
                            			foreach (NinjaTrader.Gui.Chart.IDrawObject draw in DrawObjects)
                            			{
                            				if (draw.UserDrawn &&
                            					(draw.DrawType == NinjaTrader.Gui.Chart.DrawType.Line ))
                            				{	
                            					//Sets some line properties programatically
                            					NinjaTrader.Gui.Chart.ILine globalLine = (NinjaTrader.Gui.Chart.ILine) draw;
                            					
                            					//Print out that NinjaTrader was able to get the line and the price.
                            					Print("It works " +globalLine.EndY);
                            				}
                            			}
                                    }
                            JCNinjaTrader Customer Service

                            Comment


                              #15
                              Yes, I knew that already. But I want to enter a long Position, if the price crosses the line from below. And a short Position when it crosses from above. In the linealert is something like a crossabove. I want to know how to realize this.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by thgamey, Yesterday, 08:38 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Marco  
                              Started by stredtity, Today, 01:21 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post stredtity  
                              Started by superg3, Yesterday, 10:12 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post superg3
                              by superg3
                               
                              Started by johnnybegoode, Yesterday, 07:02 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post johnnybegoode  
                              Started by YevhenShynkarenko, Yesterday, 05:02 PM
                              1 response
                              16 views
                              0 likes
                              Last Post YevhenShynkarenko  
                              Working...
                              X