Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X