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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    67 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    150 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
    99 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    286 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X