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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    70 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    152 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X