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

How to get # of bars ago using Swing syntax

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

    How to get # of bars ago using Swing syntax

    The definition of the Swing indicator says that it is possible to determine the number of bars ago a swing point occurred.

    Could you explain how can I use this indicator (what is the syntax) to to do that?

    I don't understand the syntax in the help guide, it says:

    "
    High Bar
    Swing(int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod)
    Swing(IDataSeries inputData, int strength).SwingHighBar(int barsAgo, int instance, int
    lookBackPeriod)
    "

    So, correct me if I am wrong, I think I would need to indicate barsAgo here, so how is it possible to extract it then?

    My goal is to get the number of bars ago using Swing syntax. If it claims that it is doable.

    Thank you

    #2
    Hi ionaz,

    Yes, you can use HighBar method to return the # of bars since a swing high occurred. A suitable barsAgo for the input parameter to this method is 0.

    Please see this recent thread for some ideas on using this method. The thread is about the ZigZag indicator, but swing works much the same way.

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks RyanM!

      It worked!

      Comment


        #4
        Back to the old topic, how I can find the 10'th bar from the last swing high? I looking through zigzag thread, but could not find anything helpful.Thank you in advance.

        Originally posted by NinjaTrader_RyanM1 View Post
        Hi ionaz,

        Yes, you can use HighBar method to return the # of bars since a swing high occurred. A suitable barsAgo for the input parameter to this method is 0.

        Please see this recent thread for some ideas on using this method. The thread is about the ZigZag indicator, but swing works much the same way.

        http://www.ninjatrader.com/support/f...ad.php?t=45401

        Comment


          #5
          Ok got it myself. If anyone need it:

          if(Swing(4).SwingHighBar(0, 1, 15) == 10)
          Last edited by meowflying; 02-16-2016, 03:04 AM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by kujista, Today, 06:23 AM
          5 responses
          15 views
          0 likes
          Last Post kujista
          by kujista
           
          Started by f.saeidi, Today, 10:19 AM
          0 responses
          4 views
          0 likes
          Last Post f.saeidi  
          Started by traderqz, Yesterday, 09:06 AM
          2 responses
          16 views
          0 likes
          Last Post traderqz  
          Started by traderqz, Today, 12:06 AM
          3 responses
          6 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by RideMe, 04-07-2024, 04:54 PM
          5 responses
          28 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X