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

Popup alert window

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

    #16
    Sure. In your string just add it in.

    "My message blah. Here is the price " + Close[0]

    To access high and low you need to be using High[0] and Low[0]. Be mindful of the capitalized letter.
    Josh P.NinjaTrader Customer Service

    Comment


      #17
      Thank you Josh for quick reply.

      I have changed alert message as you sugested.

      On my second question. Perhaps I did not explain the problem corectly.
      It is not a matter of accessing High or Low as it is a matter of specifying condition on the same bar (or even 2 or 3 bars), with part of the bar being above pivot and part being bellow pivot.
      Example High[0]>swingHigh and Low[0]< swingHigh which should idealyy put an arrow on the bar that is just started to breakout.
      This however does not work.
      As well as this: Close[0]>swingHigh && Close[1]< swingHigh

      I have tried to code second condition as bool and as DataSeries Signal1

      It does not work!

      Ahy sugestions?

      Thank you again.

      Comment


        #18
        xtrender,

        Please be more specific as to what you think doesn't work. What are you seeing instead?
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          Sorry Josh,

          Specificaly I can not code 2 conditions in Ninjascript that I can see on the chart and describe as this English sentence: Cond1.If High of the current Bar rises above pivot High and Cond2.the Low of the same bar still below pivot High then draw arrow on the chart.
          Problem is that Ninja does not plot the arrow based on above descibed conditions.
          In English one condition does not preclude the other.
          In Ninjascript...?
          The first condition is easy to plot but 1st and 2nd together does not plot at all.
          Any ideas?

          Thank you.

          Comment


            #20
            xtrender,

            I am not understanding you. Please post the code that you have.

            If you want an "AND" condition you need to do something like this:
            Code:
            if (condition1 && condition 2)
            {
                 // do something;
            Josh P.NinjaTrader Customer Service

            Comment


              #21
              if( (CurrentBar-1)>0
              && ToTime(Time[0])>= 93000 && ToTime(Time[0])< 160000
              && High[0] > currentSwingHigh//cond1
              && Low[0]<currentSwingLow//cond2

              //or ulternatively

              && Close[0]>currentSwingHigh//cond1
              && Close[1] < currentSwingHigh//cond2

              DrawArrowUp("MyArrowUp"+CurrentBar, 0, Low[0], Color.Lime);
              DrawText(
              "S1_near Bull"+CurrentBar, "S1_near Bull", 0, Low[0]-50* TickSize, Color.Green);
              bullBreakouts.Set(
              1);

              if (AlertOnBreakout == true)
              {

              Alert(
              "Bull S1_near ", Priority.High, "Bull S1_near ", "Alert2.wav", 100000, Color.White, Color.Blue);

              Comment


                #22
                if( (CurrentBar-1)>0
                && ToTime(Time[0])>= 93000 && ToTime(Time[0])< 160000
                && High[0] > currentSwingHigh//cond1
                && Low[0]<currentSwingLow//cond2

                //or ulternatively

                && Close[0]>currentSwingHigh//cond1
                && Close[1] < currentSwingHigh//cond2

                DrawArrowUp("MyArrowUp"+CurrentBar, 0, Low[0], Color.Lime);


                You never closed the if-statement with the ending ).
                Josh P.NinjaTrader Customer Service

                Comment


                  #23
                  Sorry Josh, but this is precisly the problem that something like this:

                  && High[0] > currentSwingHigh//cond1
                  && Low[0]<currentSwingLow//cond2

                  does not generate alert
                  Please read my previous 3 posts, I think it is obvious what I mean. I am trying to express condition when high is above the pivot while low is below the pivot on the same bar!

                  How about just get alert if(
                  High [0] > SMA(20)[0]
                  && Low[0]<SMA(20)[0] )
                  I don't understand why above doesn't draw an arrow

                  Comment


                    #24
                    OK, I am not looking for syntax help, my code compiles!

                    I am trying to express condition when high is above the pivot while low is below the pivot on the same bar!


                    Thank you.

                    Comment


                      #25
                      xtrender,

                      You need to post code you have and I will assist you in getting it working. You posted uncompilable code earlier and that is why I directed you in a direction to fix the error. Please post your latest rendition of code you are having trouble with so we can assist.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #26
                        Thank you Josh for your wilingness to look at my problem!
                        Attached Files

                        Comment


                          #27
                          xtrender,

                          Consider this:
                          Code:
                          && High[0] > currentSwingHigh 
                          && Low[0] < currentSwingHigh
                          You need to debug to see if your conditions are even being evaluated to true.

                          Pretend currentSwingHigh = 100. High[0] = 150. Low[0] = 90.

                          150 > 100
                          90 < 100

                          so that would be an example of it being true. If this condition is not true it will not draw. You need to print the values of all three to evaluate this.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #28
                            Hi Josh,

                            Can you be more specific as to how I can print out this values and debug?

                            On the chart this condition is always present . You have pivot level and the High of breakout bar is above that level (otherwise there is no breakout),while Low of the breakoutbar is below pivot. So it must be true, but apparently it has to be programed in a different way.
                            And as I mention even this doesnt draw on the chart:
                            && Close[0]>currentSwingHigh//cond1
                            && Close[1] < currentSwingHigh//cond2


                            I don't know enough about Ninja to understand why it doesn't work.


                            Thank you for help

                            Comment


                              #29
                              xtrender,

                              If the condition is truly present as determined by the printed out values, your code will execute, otherwise it will not.

                              Do this before your if-statement:
                              Code:
                              Print(Time[0] + " currentSwingHigh: " + currentSwingHigh + " High[0]: " + High[0] + " Low[0]: " + Low[0]);
                              Inside your if-statement also add another print so you know when it evaluates to true.
                              Code:
                              Print("Entered if-statement");
                              Then open your Output Window (Tools->Output Window) to see the print outs.
                              Josh P.NinjaTrader Customer Service

                              Comment


                                #30
                                live ninjatrader

                                when you go to "live ninjatrader",do you remove all ninja from the demo and then download the free ninja,or do you do something else if you are using the free version?

                                Thank you

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Jon17, Today, 04:33 PM
                                0 responses
                                1 view
                                0 likes
                                Last Post Jon17
                                by Jon17
                                 
                                Started by Javierw.ok, Today, 04:12 PM
                                0 responses
                                6 views
                                0 likes
                                Last Post Javierw.ok  
                                Started by timmbbo, Today, 08:59 AM
                                2 responses
                                10 views
                                0 likes
                                Last Post bltdavid  
                                Started by alifarahani, Today, 09:40 AM
                                6 responses
                                41 views
                                0 likes
                                Last Post alifarahani  
                                Started by Waxavi, Today, 02:10 AM
                                1 response
                                21 views
                                0 likes
                                Last Post NinjaTrader_LuisH  
                                Working...
                                X