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

Help with a order

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

    Help with a order

    Hello someone can help me with:

    Protected override void OnBarUpdate ()
    {
    // Condition enter long
    If Close (1)> Ema (10)
    EnterLong (DefaultQuantity, " ");
    }

    Only enter the first bar that the condicion is ok.

    But , what I need to do to enter the next 5 following bars with the same condition ?

    Thanks, regards.

    #2
    Hello,

    Are you asking how to allow 5 entries in the same direction?

    If so, change the Entries per direction option to 5 in the Strategy parameters when adding the script to a chart or to the Strategies tab of the Control Center.

    http://www.ninjatrader.com/support/h...rdirection.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      subsequent EnterLong() calls NO are ignored if conditions ok

      Hello again thanks for your time.

      I tried yesterday the exemple 1 but no run. if I change EntriesPerDirection=5. Enter 5 times (first bar condition ok and next 4) but only see if condition first bar is ok and no see the conditions bars 2,3,4 and 5. And the bars 3 and 4 "no condition ok" and send order.
      Regards



      // Example #1
      // If an open position already exists, subsequent EnterLong() calls are ignored.

      protected override void Initialize()
      {
      EntriesPerDirection =5;
      EntryHandling = EntryHandling.AllEntries;
      }

      protected override void OnBarUpdate()
      {
      if (Close[0]>(EMA(10)
      EnterLong("");
      }

      If an open position already exists, subsequent EnterLong() calls NO are ignored if conditions ok

      Comment


        #4
        Hello firecan,

        I am having trouble understanding your inquiry.

        Are you:

        1) Trying to place an order 4 bars after this condition is true?

        2) Trying to place an order on the 5th bar if the condition is true 5 bars in a row?

        3) Trying to place an order on every bar this condition is true for 5 bars in a row?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Picture

          I send a pictures.

          Regards.
          Last edited by firecan; 10-28-2014, 07:28 PM.

          Comment


            #6
            Hi firecan,

            Are you trying to place an order on the 6th bar after this condition is true and for the next 4 bars as well?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              No, I try that all bar close up movil average enter long.

              if Close (0) > EMA (10)
              Enter Long

              Enter long the bars 1, 2, 3, 4, -- , 6, 7, 8 and 9. becasue all this bars Close > EMA.

              The bars 5 and 10 no enter long.(Close < EMA)

              Comment


                #8
                Hello firecan,

                Thank you for clarifying this.

                It sounds like you want to enter on every bar that has this condition true, no matter how many of them there are.

                To do this, you need to set your Entries per direction to a very high number to prevent this from limiting your entries.

                Set the Entries per direction to 999. This should allow for all entries where your conditions are true to be entered.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Ok. Thanks. Regards.

                  Comment


                    #10
                    New question

                    Hello I have two questions about a renko graph.

                    The first one:

                    In a moment of high volatility, I can see some bars with the same time.

                    Is it possible to change the color of this bars with the same time?

                    Up bars = green

                    Down bars = red

                    Bars with same time = White (Up and Down)

                    Regards.

                    Comment


                      #11
                      Originally posted by firecan View Post
                      Hello I have two questions about a renko graph.

                      The first one:

                      In a moment of high volatility, I can see some bars with the same time.

                      Is it possible to change the color of this bars with the same time?

                      Up bars = green

                      Down bars = red

                      Bars with same time = White (Up and Down)

                      Regards.
                      You would have to write an indicator to do it. The main code would be:
                      Code:
                      if (Close[0] > Open[0]) BarColor = Color.Green;
                      else if (Close[0] < Open[0]) BarColor = Color.Red;
                      else  BarColor = Color.White;

                      Comment


                        #12
                        Renko

                        Thanks for your fast reply.



                        2 question:

                        The bars 1, 2, 3 and 4 go Long for the condition ok.

                        The bar 5 no enter because the condition not ok.

                        But the bars 6, 7 and 8 have the same time

                        And it happens that 6 and 7 bars does not launch orders but 8 launches three.

                        Is posible to have only one launches though 3 bars exist with the same time.

                        Regards.

                        Comment


                          #13
                          Hello firecan,

                          If you would like to prevent orders from entering when the current bars time is equal to the previous bars time, write a check for the time in the condition. Use a string so that it compares the second, or minute, or whatever part of the time and date you would like.

                          For example:

                          Code:
                          if (CurrentBar < 2)
                          return;
                          
                          if (Time[0].ToString("M/d/yyyy hh:mm:ss") != Time[1].ToString("M/d/yyyy hh:mm:ss") &&
                          		Close[0] > EMA(10)[0])
                          {
                          	//execute code
                          }
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Fantastic

                            Fantastic for that we are beginning.

                            Best impossible, with code and everything.

                            Very grateful.

                            Comment


                              #15
                              Print

                              Hello I have tried almost of everything without result
                              Can someone to say the correct code to me to print under every bar the difference between EMA(0) and EMA(1).

                              Print (EMA(5)[0] - EMA(5)[1])

                              Regards.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by samish18, Yesterday, 08:31 AM
                              3 responses
                              13 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by funk10101, Yesterday, 09:43 PM
                              1 response
                              13 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                              5 responses
                              551 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by rtwave, 04-12-2024, 09:30 AM
                              5 responses
                              37 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by funk10101, Today, 12:02 AM
                              1 response
                              11 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Working...
                              X