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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    388 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    260 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    218 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    302 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    268 views
    0 likes
    Last Post CarlTrading  
    Working...
    X