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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    24 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    20 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    14 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    11 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    41 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X