Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 The_Sec, Yesterday, 03:37 PM
              1 response
              11 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by vecnopus, Today, 06:15 AM
              0 responses
              1 view
              0 likes
              Last Post vecnopus  
              Started by Aviram Y, Today, 05:29 AM
              0 responses
              5 views
              0 likes
              Last Post Aviram Y  
              Started by quantismo, 04-17-2024, 05:13 PM
              3 responses
              27 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              36 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X