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

Drawing Trendline

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

    Drawing Trendline

    Hello,

    I'm writing indicator that draws trendlines on the chart. I look Ninjas's help file but I don't understand these:

    1. I drawing trendline X to Y, but many ticks later i must update end point. How can i do this? (Yes i know each object in Ninja has Tag, i can think i find object via its tag but wich method? I mean is there a method FindOnject(tag)?
    2. I know if i want to draw no extension line i must use drawline and if i want to extended line i must use drawextendedline. But in my indicator I drawing line at first has not left or right extension. Many ticks later sometimes i must extend before drawed line. At this scenerio maybe i must use always extended line and i set its startbarsago or endbarsago properties for extend. But i don't understand how can i set left or right extension infinite. Could you tell me how can i do this easily?

    Have a nice day.

    #2
    Hello,

    Thank you for your forum post.

    Is the line originally drawn by the script or by hand?

    Also can you please clarify on your second question what you mean by this:

    But in my indicator I drawing line at first has not left or right extension. Many ticks later sometimes i must extend before drawed line.

    I look forward to assisting you further.

    Comment


      #3
      Thanks for your interest,

      Questions is related drawn by script not by hand.
      Example about second question for clarify:
      In my script when current bar 23, i decide to draw line which Low[20] to Low[1]. And 5 minutes later when currentbar 48 i decide before draw line must be extended line. For this first i must find via tag before draw line and extend the line. This to be 3 ways,

      1.a.Draw line via drawline method.
      b.When necessery find old Line wich drow via drawline method.
      c.Delete old Line
      d. Draw line again but at this time via drawextendedline method.

      2.a.Draw line via drawline method.
      b.When necessery find old Line wich drawed via drawline method.
      c.If exist property, set old line "extend right" property to true.

      3.a.Draw line via drawextendedline method and set extend right property false.
      b.When necessery find old Line wich drawed via drawextendedline method.
      c.And set old line "extend right" property to true.

      Wich way acceptable?

      Sory for my poor english.
      Last edited by aytacasan; 10-31-2010, 12:41 PM.

      Comment


        #4
        Hello,

        Thanks for the clarification.

        For your first answer what you would do it store it in a iText object that way you can track it.

        Sample and information on this here:






        Then for your 2nd question, I do not see any parameters in our help guide to set extend. Therefor you would need to use your first option.

        1.a.Draw line via drawline method.
        b.When necessery find old Line wich drow via drawline method.
        c.Delete old Line
        d. Draw line again but at this time via drawextendedline method.
        Let me know if I can be of further assistance.

        Comment


          #5
          There is a misunderstanding. Of couse the reason is my poor English. I try again:

          1.How can i find previously drawn objects through its tag in script?
          2.How can i set ExtendedLine right or left extension zero(no extension) and infinite in script?
          3.NEW!!! I wrote an indicator. It has a property name is UpColor and its type is Color. I add this indicator to chart, set indicators UpColor property to Color.Lime and save chart teplate. Then i open other chart and select my template. But indicator UpColor comes white. So I think indicator UpColor propery not saving in template. How can i fix it?
          4.NEW!!! How can i handle 1 indicator, n plots with different displacement. I mean i'm writing an indicator and it has 2 indicator. First plot must draw 0 displacement but second plot must 3 displacement(actually -3, for future prediction). So indicators displacement property don't work here. If you say that "each plot has own displacement, set it and go or you can write script like this plot[-3]= value (not 3 bars ago, 3 bars after)" i'll be very hapy. Please inform me.

          Thanks for your interest.
          Last edited by aytacasan; 11-01-2010, 02:40 AM.

          Comment


            #6
            You can use the DrawObjects collection to find objects drawn - http://www.ninjatrader.com/support/h...rawobjects.htm

            Unfortunately you can't set the extensions programmatically - you would have to use either a regular line or an extended line depending on your needs.

            Please serialize your color properties so they could be persisted - http://www.ninjatrader.com/support/f...ead.php?t=4977

            Displacement is per indicator, not per plot - you use just plot the value [x] bars back for one plot to handle a custom displacement or use 2 indicators generally so you can set different displacement values.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Hello,

              Thanks for your interest and info. Ninja so easy to learn, effective and powerful. I have sophisticated system in other language. But i convert it only one week time and i installed ninja first time on my machine one week ago too. I love it.

              Best Regards.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by techgetgame, Today, 11:42 PM
              0 responses
              3 views
              0 likes
              Last Post techgetgame  
              Started by sephichapdson, Today, 11:36 PM
              0 responses
              1 view
              0 likes
              Last Post sephichapdson  
              Started by bortz, 11-06-2023, 08:04 AM
              47 responses
              1,612 views
              0 likes
              Last Post aligator  
              Started by jaybedreamin, Today, 05:56 PM
              0 responses
              9 views
              0 likes
              Last Post jaybedreamin  
              Started by DJ888, 04-16-2024, 06:09 PM
              6 responses
              19 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Working...
              X