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

SwingHighBar/SwingLowBar

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

    SwingHighBar/SwingLowBar

    A question about the parameters for SwingHighBar/SwingLowBar.

    Code:
    Swing(int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod)
    Let's suppose:
    strength = 5
    barsAgo = 1
    instance = 1
    lookBackPeriod = CurrentBar

    If the most recent (visually identifiable on a chart) swing high occurs 4 bars ago (let's call it bar SH1), it should not be identified by this function. Which reason applies?

    1. only 4 bars have passed since SH1 and since strength is 5, the function needs one more lower bar to identify SH1 as a swing high bar. So when CurrentBar moves forward 1 day, assuming it's a lower bar, SH1 will be identified.

    2. only 3 bars have passed from SH1 to the beginning of the search period (CurrentBar - 1), and since strength is 5, the function needs two more lower bars to identify SH1 as a swing high bar. So when CurrentBar moves forward 2 days, assuming two lower bars, SH1 will be identified.

    If reason #2 applies, then if we adjust barsAgo so that it fixates on the same date (e.g., we increment barsAgo by 1 every day), then SH1 will never be identified as a swing high bar because the number of days between SH1 and the beginning of the search will always be less than the strength period.

    So what I'm trying to get at is can the function identify a swing high that occurs within strength bars of the search period, assuming there are strength lower bars on either side of the swing high?
    Last edited by dolomite; 02-28-2015, 06:26 PM.

    #2
    Hello dolomite,

    Thank you for your post.

    The Swing High would need to occur within one bar as is the look back parameter. So it would not find a value unless the new swing is calculated within one bar - which is possible.

    Test Printing the value with Print() and open the Output window (Tools > Output) before testing the Print() to see if any values are printed.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by geotrades1, Today, 10:02 AM
    2 responses
    5 views
    0 likes
    Last Post geotrades1  
    Started by ender_wiggum, Today, 09:50 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by rajendrasubedi2023, Today, 09:50 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by bmartz, Today, 09:30 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by geddyisodin, Today, 05:20 AM
    4 responses
    28 views
    0 likes
    Last Post geddyisodin  
    Working...
    X