Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Swing High/low

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

    Swing High/low

    Iam am trying to use the code below to find the last two swing highs and then draw a line between them, i.e. a trend line but the code is not working. Where am I going wrong?

    swhigh15m1 = (High[Math.Max(0, Swing(1).SwingHighBar(0, 1, 50))]);
    swhigh15m2 = (High[Math.Max(0, Swing(1).SwingHighBar(0, 2, 50))]);

    if (swhigh15m1 < swhigh15m2)
    {
    DrawLine("15minhigh", Swing(1).SwingHighBar(0, 2, 50), swhigh15m2, Swing(1).SwingHighBar(0, 1, 50), swhigh15m1, Color.Blue, DashStyle.Solid,1);
    }

    #2
    What part of the code isn't working? It is helpful to break down each code segment and find out exactly where something goes wrong.

    Are there any errors in your logs (right-most tab in Control Center)?

    I'm not exactly sure what you're looking to do, but take a look at this code and see if it helps you get going in the right direction:
    Code:
                int swhigh15m1 = Swing(1).SwingHighBar(0, 1, 50);
                int swhigh15m2 = Swing(1).SwingHighBar(0, 2, 50);
                
                if (swhigh15m1 < swhigh15m2)
                {
                    DrawLine("high" + CurrentBar, swhigh15m1, High[swhigh15m1], swhigh15m2, High[swhigh15m2], Color.Blue, DashStyle.Solid, 1);
    //              DrawLine("15minhigh", Swing(1).SwingHighBar(0, 2, 50), swhigh15m2, Swing(1).SwingHighBar(0, 1, 50), swhigh15m1, Color.Blue, DashStyle.Solid,1);
                }
    AustinNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X