Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need Help Identifying Swing High/Low

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

    Need Help Identifying Swing High/Low

    I'm trying to draw Fibonacci based on whether a higher swing structure was formed based on. In other words, the Fibonacci will only be drawn if the current swing high is higher than the previous one. Here is my code that's not working. See attached pic for more detail.

    private int lastHighBar ()
    {
    return Swing(strength).SwingHighBar(1,1,200);
    }
    private double lastHighBarValue ()
    {
    return Swing(strength).SwingHigh[strength+1];
    }
    private int lastLowBar ()
    {
    return Swing(strength).SwingLowBar(1,1,200);
    }
    private double lastLowBarValue ()
    {
    return Swing(strength).SwingLow[strength+1];
    }

    if ((lastLowBar() > lastHighBar()) && (HH1 = false) )
    {
    HH1 = true;
    HHP1 = lastHighBarValue ();

    }

    if ((lastLowBar() > lastHighBar())
    // && lastHighBarValue () > HHP1

    // && (lastHighBarValue () > HHP1)

    )


    {
    // HH1 = true;

    HHP2 = lastHighBarValue ();
    // HHP1 = 0;
    // HH1 = false;

    }

    if (HHP2 > HHP1)

    {
    Draw.FibonacciRetracements(this, "line"+CurrentBar, false, lastLowBar(), lastLowBarValue(), lastHighBar(), lastHighBarValue());

    HH1 = false;
    }
    Attached Files

    #2
    Hi cryfgg, thanks for posting. The first thing to do will be to add Prints to print out the data you are using in FibonacciRetracements. This should be the first step in any debugging process.

    Code:
    if (HHP2 > HHP1)
    {
        Print(Time[0]);
        Print(lastLowBar());
        Print(lastLowBarValue());
        Print(lastHighBar());
        Print(lastHighBarValue());
        Print(" "); //separator to keep each signal organized. 
        Draw.FibonacciRetracements(this, "line"+CurrentBar, false, lastLowBar(), lastLowBarValue(), lastHighBar(), lastHighBarValue());
        HH1 = false;
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    63 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    92 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    48 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    106 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    63 views
    0 likes
    Last Post PaulMohn  
    Working...
    X