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