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

TrendLine

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

    TrendLine

    Is there a way to return the price value of a trend line at the current bar?

    I have the value of the swing highs and lows in the strategy.

    The trend line is based on the high and low close of the bars not the actual high and low. The tails and wicks of the bars are causing too many "false trend lines".

    I was trying to modify the trendline indicator as it does what I need with the exception of using the close of the bars. I have not been successful.


    Thank you

    #2
    Hello sdauteuil,

    Thank you for the post.

    You could access that from another script by using the plot it exposes. It looks like there is also some logic inside the trendline indicator checking for crossing in realtime, you could likely use it in a similar way from other scripts.

    To access a plot value from the current bar you would use [0] for the BarsAgo.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Do you mean using something like DrawLine() in my strategy?

      Or are do you mean accessing the plot from the trendline indicator?

      Comment


        #4
        Hello sdauteuil,

        Thank you for the post.

        I was referring to accessing the plot of the trendline indicator, it exposes 1 plot and uses that plot for its alert conditions.


        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          The problem I have with the trendline indicator is that the values it uses to create the trendline are based on the actual high and low of the bar.

          I need to have the trendline drawn from the closing values of the bar. So if the bar closes at a new high or low the closing value of the bar would be the value for creating the trendline.

          Using the trendline indicator as it is returns too many trendline changes. I have tried increasing the strength value of the indicator which does help somewhat.

          I have my strategy code calculating the respective values I need but I am not sure how to create the trendline and obtain the value at the current bar.
          I was trying to figure out if I could alter the indicator code to use my values or if there was some other way to accomplish this.

          Hope that makes sense.

          Thank again

          Comment


            #6
            Hello sdauteuil,

            If your strategy already calculating the value you need to use then it would likely be easiest to copy that logic into the indicator. You could then use the calculated value in whatever way you wanted in the indicators calculations.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              That is what I was attempting but I couldn't figure how the high and low values were being calculated.

              I see now that they are being pulled from the Swing indicator.

              Thanks again

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DJ888, 04-16-2024, 06:09 PM
              6 responses
              18 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by Jon17, Today, 04:33 PM
              0 responses
              1 view
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              6 views
              0 likes
              Last Post Javierw.ok  
              Started by timmbbo, Today, 08:59 AM
              2 responses
              10 views
              0 likes
              Last Post bltdavid  
              Started by alifarahani, Today, 09:40 AM
              6 responses
              41 views
              0 likes
              Last Post alifarahani  
              Working...
              X