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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X