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.


    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.


    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.


        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.

                Following are links to all available NinjaScript reference samples within this forum section: Strategy Reference Samples (NinjaTrader 8) - also applicable to NT7 Using a time filter to limit trading hours (http://www.ninjatrader.com/support/forum/showthread.php?t=3226) Using multiple entry/exit signals simultaneously


                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 Christopher_R, Today, 12:29 AM
                              0 responses
                              9 views
                              0 likes
                              Last Post Christopher_R  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              166 responses
                              2,235 views
                              0 likes
                              Last Post sidlercom80  
                              Started by thread, Yesterday, 11:58 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post thread
                              by thread
                               
                              Started by jclose, Yesterday, 09:37 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post jclose
                              by jclose
                               
                              Started by WeyldFalcon, 08-07-2020, 06:13 AM
                              10 responses
                              1,415 views
                              0 likes
                              Last Post Traderontheroad  
                              Working...
                              X