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

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 devatechnologies, 04-14-2024, 02:58 PM
                  3 responses
                  19 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by tkaboris, Today, 08:01 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post tkaboris  
                  Started by BarzTrading, Today, 07:25 AM
                  1 response
                  11 views
                  1 like
                  Last Post NinjaTrader_Clayton  
                  Started by EB Worx, 04-04-2023, 02:34 AM
                  7 responses
                  161 views
                  0 likes
                  Last Post VFI26
                  by VFI26
                   
                  Started by Mizzouman1, Today, 07:35 AM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Working...
                  X