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 helpwanted, Today, 03:06 AM
    1 response
    12 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    9 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    5 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    387 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X