Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automatically plot a line "x ticks/pts" below swing highs/above swing lows

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

    Automatically plot a line "x ticks/pts" below swing highs/above swing lows

    I am trying to find some code that I can modify/adapt to automatically plot a line "x ticks/pts" below recent swing highs/above recent swing lows.

    For example, swing high was at 100 and the retracement amount is say 4 then I want a line drawn/dots on the chart when/if the market reaches 96.

    The line would only be a few bars to the left and right of the bar that hit the level i.e. I want the line to be clear and not just one dot ideally.

    Look back period is x bars.

    #2
    Hello skiguy,

    Thank you for your post.

    The following is a basis example of what you have detailed.
    Code:
    			if(Close[0] >= Swing(3).SwingHigh[0] - (distance*TickSize))
    			{
    				DrawVerticalLine("line", 0, Color.Blue);
    			}

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello skiguy,

      Thank you for your post.

      The following is a basis example of what you have detailed.
      Code:
      			if(Close[0] >= Swing(3).SwingHigh[0] - (distance*TickSize))
      			{
      				DrawVerticalLine("line", 0, Color.Blue);
      			}
      Thanks.

      Rather than the close is there an option that would cover if the mkt traded at that calculated level?

      Also I want to raw a horizontal line of for example dots covering say 3 bars at that retracement level.

      Comment


        #4
        Swing indicator

        Okay I found the swing indicator.

        It looks like exactly what I want but I want the plot(dots) to be the swing high value - my value e.g. 3.

        The code is fairly advanced for me.

        Could someone please highlight the code that actually plots the dots and can I just subtract a value from it without stuffing up the rest of the code i.e. it still needs to detect new swing highs but when a new swing high is detected I want to plot the (new swing high - x).

        The Word file has a screenshot of a chart with the Swing indicator applied.
        Attached Files

        Comment


          #5
          Any takers?

          I need some help to plot the retracement levels.

          Comment


            #6
            Hello Skiguy,

            There is a Private DataSeries that is used to plot the dots, called SwingHighPlot and SwingLowPlot.

            You would need to save the Swing as a new indicator, Right click in the Swing editor and select Save As...
            Give it a new name.
            This will allow you to change these Private DataSeries to Public so that they can be accessed by other scripts.
            Code:
            public DataSeries SwingHighPlot
            		{
            			get 
            			{
            				Update();
            				return Values[0]; 
            			}
            		}
            Below is an example of how to call the new data series-
            Code:
            mySwing(4).SwingHighPlot[0]
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by skiguy View Post
              Okay I found the swing indicator.

              It looks like exactly what I want but I want the plot(dots) to be the swing high value - my value e.g. 3.

              The code is fairly advanced for me.

              Could someone please highlight the code that actually plots the dots and can I just subtract a value from it without stuffing up the rest of the code i.e. it still needs to detect new swing highs but when a new swing high is detected I want to plot the (new swing high - x).

              The Word file has a screenshot of a chart with the Swing indicator applied.
              Your picture is not clear how it differs from the standard, shipping, Swing indicator. It seems to be plotting the same, at the actual swing point. Am I not seeing it right?

              Comment


                #8
                Yes it is the standard one to illustrate what I am talking about i.e. I want retracements fromthose levels plotted.

                Comment


                  #9
                  Thanks I have a crack at that

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by WaveAtElliot, Today, 05:11 PM
                  1 response
                  7 views
                  1 like
                  Last Post hdge4u
                  by hdge4u
                   
                  Started by bosajin, Yesterday, 09:15 AM
                  5 responses
                  35 views
                  0 likes
                  Last Post NinjaTrader_Jim  
                  Started by Dolfan, Today, 12:24 PM
                  4 responses
                  22 views
                  0 likes
                  Last Post NinjaTrader_Jim  
                  Started by WeyldFalcon, Today, 11:09 AM
                  7 responses
                  25 views
                  0 likes
                  Last Post WeyldFalcon  
                  Started by DTSSTS, 08-10-2020, 09:48 AM
                  12 responses
                  67 views
                  0 likes
                  Last Post DTSSTS
                  by DTSSTS
                   
                  Working...
                  X