Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trend Line Jump

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

    Trend Line Jump

    I there anyway to get the value of a trend line at the current bar.

    AddTrendLine(upTrendStartBarsAgo, startBarPrice, upTrendEndBarsAgo, endBarPrice, UpTrendColor);

    this is the code i used to make the trend line.

    #2
    Hello cbart_1,

    Yes, it may be possible with custom programming. Is AddTrendLine() a custom method or an indicator script of yours that draws lines?

    One approach to this is to work with exposed ILine values to calculate a slope. Once you have that, can calculate the lines value at any point.

    Last edited by NinjaTrader_RyanM1; 09-27-2011, 09:11 AM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      the slope

      i know how to figure the slope but how do i use it to figure the value of the current bar.

      OK i loaded up the indicator but there is a lot of extra stuff in in that needs to be taken out.
      Attached Files
      Last edited by cbart_1; 09-27-2011, 09:38 AM. Reason: adding more to it

      Comment


        #4
        I created a script that can do this, available here:



        Hopefully that provides some guidance on accessing lineValueAtLastBar. This script was created in my spare time. I'm sure you can understand that NinjaTrader is not able to provide additional coding guidance on this project. Should you need this, any of our NinjaScript consultants can assist:
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          ok I think i got it

          thank you for the script you gave but i think i got it i have th ecode to do this but it was for 1 bar over and i want 3 bars over before it alarms.

          Comment


            #6
            ok i still have a problem

            this is my code to check the previous bars to see if they crossed the trend line. i think i have it correct, but it keeps sounding the alarm on every bar. and it doesnt draw the arrow. so i dont think it is even entering the if statement.

            if (Close[3] > DendBarPrice + (Math.Abs(downTrendEndBarsAgo - 3) * DchangePerBar) && Open[2] > DendBarPrice + (Math.Abs(downTrendEndBarsAgo - 2) * DchangePerBar) && Open[1] > DendBarPrice + (Math.Abs(downTrendEndBarsAgo - 1) * DchangePerBar) && Open[0] > DendBarPrice + (Math.Abs(downTrendEndBarsAgo) * DchangePerBar))
            {
            if(!Historical && sTime[0] == 1)
            {
            //RemoveDrawObject("DownTrendBreak");
            DrawArrowUp("DownTrendBreak", 3, Low[3] + TickSize, Color.Blue);
            vPlayCount =
            3;
            Alert(
            "Alert", Priority.High, "Down trend line broken", iAlert, 100000, Color.Black, Color.Green);
            }
            }
            Last edited by cbart_1; 09-28-2011, 10:53 AM.

            Comment


              #7
              Best of luck tracking this down, cbart_1. You will need to Print all values to verify they're what you expect, and simplify the code until it's at a point where you can follow the behavior.
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              574 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              333 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              553 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              551 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X