Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trendline Indicator in Strategy.

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

    Trendline Indicator in Strategy.

    Hi All,
    I am trying to use Trendline indicator in Strategy Builder but while running the strategy it does not works , can anyone please guide on the same.
    Thanks in advance.

    #2
    Hello tausifkhan,

    Welcome to the NinjaTrader support forums.

    I wanted to confirm, are you referring to the "TrendLines" indicator that comes with NT8?

    The TrendLines that comes with the platform may not work as you would expect in contrast to NinjaScript, the plot which is used in this indicator is not exposed as a signal and is just being used to control the alerts. The actual trend line being drawn uses other logic in the script to calculate its placement. Because of this the plot which the indicator has very likely could not be used as a signal for the purpose of matching the drawn trend line.


    I look forward to being of further assistance.


    Comment


      #3
      I want buy signal to be generated when candle closes above the trendline created in NT8 , how to achieve it now ?

      Comment


        #4
        Hello tausifkhan,

        Thank you for clarifying.

        To achieve this would require manual programming unfortunately. To use the actual drawn line it would require either correctly exposing the values from the indicator so the strategy knows the actual line prices or you would need to use the drawing objects collection to locate the line and check its value. Both of these tasks would need to be completed in manual coding unfortunately.



        I look forward to being of further assistance.

        Comment


          #5
          Jesse, Sounds interesting. Is there a code sample or a guideline for coding the a moveable trendline in Ninjascript you can point me to? Thanks.

          Comment


            #6
            Hello designer01,

            There is not any type of guide or tutorial for that. If you are asking how to edit the existing trend line indicator you would need to add code which uses the private highTrend or lowTrend variables, those are the actual objects it uses for the pricing. If you mean to code your own movable line that depends on what you mean, are you referring to manually drawing lines in some way?

            Comment


              #7
              One option will be to modify the default NT8 Trendline indicator to be drawn based on coordinates rather than preset High and Lows?
              This is a video sample of what I am trying to achieve. Yes it's possible to be a manually drawn line if that is achievable by coding . See video link below.

              Last edited by designer01; 06-12-2023, 11:57 AM.

              Comment


                #8

                Hello designer01,

                Making a trendline based on coordinates from the chart would require using OnRender. The existing indicator does not use coordinates but instead uses bar events and prices. If you wanted to work with chart coordinates and also draw items manually you would be looking at creating a drawing object instead of using an indicator. The drawing objects work based on mouse events and then use OnRender to draw on the chart.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Yesterday, 05:17 AM
                0 responses
                56 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                132 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                73 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
                49 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X