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

change of style in ray

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

    change of style in ray

    Help please.
    I have this indicator draws a ray upon completion of the condition.
    If two bars close above the ray ray I want the change of style.
    No how.
    Gracias
    Attached Files
    Last edited by julifro; 01-30-2015, 02:01 PM.

    #2
    Hello julifro,

    I am not able to see the screenshot you have attached, it is very small.

    What is the style you are trying to change?

    Are you wanting to change the DashStyle?

    Are you referring to the last two bar closes being above the ray?

    Are you referring to the second point of the ray?

    This can be done by adding another if statement.

    if (Close[0] > Close[1] &&
    Close[0] > Close[2] &&
    Close[0] > Close[3] &&
    Close[0] > Close[-1] &&
    Close[0] > Close[-2] &&
    Close[0] > Close[-3])
    {
    DrawTriangleDown(CurrentBar.ToString(), true, 0, High[0] + ((TickSize * 2) * 2), Color.Blue);

    if (Close[0] > High[0] + ((TickSize * 2) * 2) && Close[1] > High[0] + ((TickSize * 2) * 2))
    {
    DrawRay("rayH", true, 1, High[0] + ((TickSize * 2) * 2), 0, High[0] + ((TickSize * 2) * 2), Color.Brown, DashStyle.Solid, 2);
    }
    else{
    DrawRay("rayH", true, 1, High[0] + ((TickSize * 2) * 2), 0, High[0] + ((TickSize * 2) * 2), Color.Brown, DashStyle.Dash, 2);
    }
    //BarColor = Color.Blue;
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply.

      I uploaded the image again

      What I want is this

      When the condition occurs

      if (Close [0]> Close [1] &&
      Close [0]> Close [2] &&
      Close [0]> Close [3] &&
      Close [0]> Close [-1] &&
      Close [0]> Close [-2] &&
      Close [0]> Close [-3])

      one ray is drawn:

      * Color.Brown, DashStyle.Solid, 2

      if after drawing the ray Brown Solid 2 bar closes below the ray

      Color.Blue ray changes, DashStyle.Dash, 2

      Excuse my English. Thank You

      Comment


        #4
        Hello julifro,

        I may not be understanding your inquiry correctly.

        When you mention "if after drawing the ray Brown Solid 2 bar closes below the ray" are you wanting to change the ray to a dash if the bar closes below the ray?

        If so, does the code I have suggested not work for you?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          yes. that's what I want.

          your code does not help me or I will not run

          thank you very much

          Comment


            #6
            anyone can help me please? thank you very much

            Comment


              #7
              Hello julifro,

              The code that I have suggested was to do this.

              Have you attempted to implement this suggestion?

              May I see the code you have written?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thank you for your help.
                Attached Files

                Comment


                  #9
                  Hello julifro,

                  Two issues.

                  One, you have the ray called again with the same tag name on line 66. This makes lines 56 through 63 completely ignored.

                  So that if statement on line 56, is not doing anything.

                  Then, on lines 84 and 87, you are reusing the same tag without incrementing it. This means that there will only be one brown line ever on the chart.

                  I ran this on the Market Replay to see if the condition on line is 82 is ever true, and I am not seeing that condition is ever true.
                  This:
                  Close[0] > High[0] + ((TickSize * 2) * 2) && Close[1] > High[0] + ((TickSize * 2) * 2)
                  is never true.

                  So that one brown line will always be dashed.

                  Add prints to your code to see when these conditions are true.
                  For example:
                  Print(Time[0]+" | Close[0]: "+Close[0]+" > High[0] + ((TickSize * 2) * 2): "+(High[0] + ((TickSize * 2) * 2))+" && Close[1]: "+Close[1]+" > High[0] + ((TickSize * 2) * 2): "+(High[0] + ((TickSize * 2) * 2)));

                  Add that print below the DrawTriangleUp on line 81.

                  What prints in the output window with this?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Close[0] > High[0] + ((TickSize * 2) * 2)
                    That expression can never, ever, be true. Nothing can ever close higher than its high: that is impossible in an absolute sense.

                    Comment


                      #11
                      My bad English makes me not explain well.
                      This is the indicator

                      if(CurrentBar < 3)
                      return;
                      if (Close[0] > Close[1] &&
                      Close[0] > Close[2]&&
                      Close[0] > Close[3]&&


                      Close[0] > Close[-1]&&
                      Close[0] > Close[-2]&&
                      Close[0] > Close[-3])

                      {
                      DrawTriangleDown(CurrentBar.ToString(), true, 0, High[0]+((TickSize*2)*2), Color.Blue);

                      DrawRay("rayH"+CurrentBar,true, 1, High[0]+((TickSize*2)*2), 0, High[0]+((TickSize*2)*2),Color.Black,DashStyle.Dash,2);
                      I think it would

                      one ray under each triangle is drawn down.

                      Now I want each one of those ray style change when two bars close above each of the rays drawn above

                      I think it would

                      if Close [0] && Close [1]> Ray
                      ray changes of style.

                      but not I like to refer to each ray

                      Deputy indicator

                      Thank You
                      Attached Files

                      Comment


                        #12
                        Hello julifro,

                        Close[-1], Close[-2], and Close[-3], don't exist. This means these will not return any values.

                        Just to confirm, the condition you are looking for is: if the close of the most recently closed bar is greater than the close prices of the previous 3 bars, then draw a triangle and a ray, is this correct?

                        What is the condition for the changing the ray from solid to dashed?

                        I ask because Close[0] > High[0] + ((TickSize * 2) * 2) will never be true.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          do not.
                          no problem with the triangle and draw the line.
                          what I want is that after drawing the ray if two bars close up of the ray ray change from solid to dot.

                          Comment


                            #14
                            Hello julifro,

                            What is the condition for the changing the ray from solid to dashed?

                            I ask because Close[0] > High[0] + ((TickSize * 2) * 2) will never be true.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Close[0]&&Close[1]>ray

                              Ray change style.

                              goodnight and thanks

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by rhyminkevin, Today, 04:58 PM
                              3 responses
                              47 views
                              0 likes
                              Last Post Anfedport  
                              Started by iceman2018, Today, 05:07 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post iceman2018  
                              Started by lightsun47, Today, 03:51 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post lightsun47  
                              Started by 00nevest, Today, 02:27 PM
                              1 response
                              14 views
                              0 likes
                              Last Post 00nevest  
                              Started by futtrader, 04-21-2024, 01:50 AM
                              4 responses
                              50 views
                              0 likes
                              Last Post futtrader  
                              Working...
                              X