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

Swing Indicator Question

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

    Swing Indicator Question

    Hi I was just reading through the help guide, relating to the swing indicator

    i think i generally understand it but I am trying to get a couple of values:

    1) Print off the past 3 swing high and low (instance) values. I think this works
    Code:
    Print(High[Math.Max(0, Swing(5).SwingHighBar(0, 1, 100))]);
    Print(High[Math.Max(0, Swing(5).SwingHighBar(0, 2, 100))] );
    Print(High[Math.Max(0, Swing(5).SwingHighBar(0, 3, 100))] );
    2) Determine when those swing values occurred. I assume I have to use the GetBar or something similar. I am not really sure how to do this

    3) What does the lookback period mean. In the example on the online help documentation, the look back period was set to 10. Does that mean that only the last 10 bars will be looked at to find a swing high. I would probably want to look back at 100 bars (to ensure I get the 1, 2 and 3rd instance of the swing high data series) but reading from this post (post #7 from Josh), i got the impression I should put the look back to 0. I am just not sure what it means..

    Thanks

    Avi

    #2
    Hi Avi, the code looks good, just be aware that you need 5 bars on each side then to identify the swing point.

    To get the time when this occured just plug the returned barsAgo values into the Time method - this would return a DateTime then.

    The lookback signifies how many bars to lookback on the chart to search for the instances of the specified swing points.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,607 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    9 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    19 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    6 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    15 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X