Announcement

Collapse
No announcement yet.

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.

    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.

        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.

            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 NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              59 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              134 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              74 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              45 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              50 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X