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

Persistent Drawing Object from within Indicator

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

    Persistent Drawing Object from within Indicator

    What is the correct way to draw a persistent ray from within an indicator.

    Currently when a ray(s) are drawn from within custom indicator, they are displayed on chart, in real time. The rays stay on chart unit I close NT and restart, or until I reapply the same indicator after changing a user accessible parameter. The indicator itself is not coded to remove any rays.

    Thanks,


    note: I use standard lib call to draw ray:
    DrawRay("name"+(CurrentBar-1), false, 1, High[0], 0, High[0], Color.Green, DashStyle.Dash, 1);
    Last edited by phineas; 06-27-2018, 09:25 AM.

    #2
    Hello phineas,

    Thank you for your note.

    Since your Ray is a horizontal line, High[0] to High[0], the following would draw a persistent line across the chart.

    Draw.HorizontalLine(this, "this", High[0], Brushes.Red);

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      I'm actually drawing a ray that is horizontal. It starts one bar back from current bar. I prefer a ray, when looking back at chart it allows me to see more quickly where ray started.

      Is there a way to draw a persistent ray similar to your recommended persistent horizontal line?

      Comment


        #4
        Hello phineas,

        Are you seeing errors in the log tab?

        If you add a current bar check above your draw method, does the issue resolve?

        Code:
        if(CurrentBar<30) return;
        	DrawRay("name"+(CurrentBar-1), false, 1, High[0], 0, High[0], Color.Green, DashStyle.Dash, 1);
        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          I verified there are no errors in Log Tab.

          I have now included your suggestion. Waited for a couple of rays to be drawn on chart. Opened the indicator panel. Made no changes and hit okay. The chart redrew, but the ray's that had been drawn where now missing.

          Am I doing something incorrectly, should the ray's be persistent?

          Thanks,

          Comment


            #6
            Hello phineas,

            May I confirm you removed the indicator and reapplied it to the chart after you made the change?

            I look forward to your reply.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              I made suggested change to the indicator, removed and reapplied the indicator. I then waited for a few rays to draw. I then brought up the indicator panel, made no changes and clicked on okay button. The rays where no longer on chart.

              Comment


                #8
                Hello phineas,

                Thank you for writing in.

                Could you please send an email to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and attach the log and trace files for the day in subject which you can find in My Documents>NinjaTrader7>Log and My Documents>NinjaTrader7/Trace folders.

                I look forward to your email.
                Alan P.NinjaTrader Customer Service

                Comment


                  #9
                  Alan,

                  I will send tomorrow. Thanks.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by cre8able, Today, 03:20 PM
                  1 response
                  9 views
                  0 likes
                  Last Post cre8able  
                  Started by fiddich, Today, 05:25 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post fiddich
                  by fiddich
                   
                  Started by gemify, 11-11-2022, 11:52 AM
                  6 responses
                  804 views
                  2 likes
                  Last Post ultls
                  by ultls
                   
                  Started by ScottWalsh, Today, 04:52 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post ScottWalsh  
                  Started by ScottWalsh, Today, 04:29 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post ScottWalsh  
                  Working...
                  X