Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Non Historical Swing Indicator

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

    Non Historical Swing Indicator

    What language would it take to modify the normal ninjatrader swing indicator to show only the last high and low swings?

    #2
    Hi Rallii, thanks for posting.

    I made this "Single dot" Swing indicator that only shows the original swing point:


    Alternatively, you can make a new indicator that adds a Swing() object and uses a Draw command to draw just one data point for each bar e.g. Draw.ArrowUp.


    Kind regards,
    -ChrisL

    Comment


      #3
      Thanks Chris! works like a charm!

      Comment


        #4
        Is there a way to have a strategy use a draw object like a horizontal line as a profit target?

        Comment


          #5
          Hi Ralli, thanks for the follow up.

          You can iterate and identify specific drawing tools in the DrawObjects collection and submit an order using its price value:



          Kind regards,
          -ChrisL

          Comment


            #6
            Thanks, Chris!

            A more complicated question, How would I get a strategy to at the entry draw a Gann Fan and then use the rays as an exit.. Like the price action has to stay between the 1x8 and the 1x2, and exit when the close crosses below the 1x2? is that possible?

            Comment


              #7
              Hi, thanks for your reply.

              Yes, that is possible to do. Please see the documentation for the Gann Fan and look at the properties that can be accessed from the script:



              You can use the value of its anchors in order in your strategy.

              Best regards,
              -ChrisL

              Comment


                #8
                Thank Chris, A bit out of my league at the moment.. Do you have an example of a script that uses drawn objects as exits?

                Comment


                  #9
                  Hi, thanks for your reply. I do not know of an exact example of using draw objects You will need to test out the available data by first drawing the tools you want to use (manually on the chart or through NinjaScript) and accessing the data from the objects. Start by using the HorizontalLine tool as this only has one data point. If you draw the line from your script, using Draw.HorizontalLine, you can access the data directly, e.g. HorizontalLine HZ = Draw.HorizontalLine(this, "tag1", 1000, Brushes.Black); //data can be accessed from HZ.

                  If you draw the line manually, you will need to iterate the DrawObjects array and find the line first, then you can access the data once found. There are small examples here as well:



                  Best regards,
                  -ChrisL


                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by CarlTrading, 03-31-2026, 09:41 PM
                  1 response
                  81 views
                  1 like
                  Last Post NinjaTrader_ChelseaB  
                  Started by CarlTrading, 04-01-2026, 02:41 AM
                  0 responses
                  42 views
                  0 likes
                  Last Post CarlTrading  
                  Started by CaptainJack, 03-31-2026, 11:44 PM
                  0 responses
                  64 views
                  2 likes
                  Last Post CaptainJack  
                  Started by CarlTrading, 03-30-2026, 11:51 AM
                  0 responses
                  66 views
                  0 likes
                  Last Post CarlTrading  
                  Started by CarlTrading, 03-30-2026, 11:48 AM
                  0 responses
                  54 views
                  0 likes
                  Last Post CarlTrading  
                  Working...
                  X