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

DrawLine problem.

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

    DrawLine problem.

    Hello,

    I write code like this in OnBarUpdate event:

    if (Bars.FirstBarOfSession)
    {
    DateTime sessionBegin, sessionEnd;
    Bars.Session.GetNextBeginEnd(Time[0], out sessionBegin, out sessionEnd);
    DrawLine(CurrentBar.ToString(), false, sessionBegin, value, sessionEnd, value, color, LineDashStyle, LineWidth);
    }

    Suppose I add this indicator 15 min chart. When I look at my chart i see that line. But if i zoom in enough, that line disappear sometimes. I mean supppose i shift my chart via right keyboard key. I click this key X times and I see the line is gone then X times click I see the line is come again. I send attachments.

    How can i fix it?
    Attached Files

    #2
    i suppose that is a known issue. i had the same problem. refer to this thread.

    Comment


      #3
      Hello Bukkan,

      Thanks for your informaion about your same problem. Yes This is the same problem with mine. But i don't see any solution your thread! I need solution. I don't know why you need draw rectangle in your chart. But I need draw this lines correctly. Because this lines is support&resistance. For me and for my stuation don't acceptable this limitation. Or must be alternative way. This is not extreme thing. This is normal to want to draw support&resistance line from session start to session end especially for day traders like me.

      Best Regards.
      Last edited by aytacasan; 11-28-2010, 08:44 AM.

      Comment


        #4
        aytacasan, you could for example draw your S/R levels using Plots that set a value for each bar.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          aytacasan,
          as i already said in my previous post its a known issue with NT.

          as Bartrand said you can use Plots to draw lines. but if your are trying to draw lines which are dynamic in nature then you will met with limitations on that path.

          but the good thing with NT is there is always a way. instead of drawing lines (Draw Objects) draw/paint some graphics. thats all the hint i can give you. you have to be imaginative.

          cheers

          Comment


            #6
            Hello My Friends,

            Bertrand, thanks for your advice but this will not solved my problem. Because my support&resistance areas is confluence fib levels, dynamic values and numbers. I mean for example, one day i have 30 line one day later 30+ or 30- levels. If my support/resistance level consist of levels like daily pivots like Ninja's pivot indicator, yes maybe this solution can be fine for me. But now can't.

            Bukkan, yes i realy understand what is talking about you. I don't know why I didn't think that before. I can draw lines via override plot method and draw lines manually. Ok. thanks for your idea.

            PS: My advice is Ninja have to solve this problem even though using DrawLine metod. Yes i understand why this limitation and how this limitation increase Ninja's draw chart performans. But this have to solve internally. Maybe like this. When i draw line sessonbegin to sessionend, and any moment if start of line so far Ninja before draw the line apply to line coordinates crop operation. I mean suppose i draw line 300. Bar to 10. bar. suppose any moment far left bar is 200. bar. So line can draw 200. to X. Sory for poor english. I hope i can tell my idea.

            Regards.
            Last edited by aytacasan; 11-28-2010, 03:03 PM.

            Comment


              #7
              Hello,

              A few minutes ago i tried draw my lines via Plot method. Result is absolutely fail. I don't understand why so hard draw simple line in Ninja. I failed because we can draw anything instantly in Plot method.

              My indicator start calculation previous session begin and when next session begin results filing in lines array by elimination and Drawing this lines current session begin to end. So I can't draw previous sessions lines because new calculated lines filling previous calculated lines array session to session because performans reasons(my chart looks back min. 100 days and my indicator working min. 10 time frames). Moreover as the associated this problem i don't draw lines when chart showing more than one session at the same time. I have one(last) session lines array.

              Bertrand, what is your thinking about my draw line suggestion? And have you any other idea about my problem?

              Thanks.

              Comment


                #8
                aytacasan, thanks for your suggestion and enhancement ideas - unfortunately I would not have another idea, if the current options are too limiting for you, I suggest to go with bukkan's idea and just custom plot / draw using C# entirely in your code - CustomPlotSample and the PowerVolume indicators could be reviewed for coding snippets.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Hi,

                  Thanks for your reply. My previous post i work to tell you that why draw my lines custom is impossible . So I can't do this this situation. But I think i have an idea for solve this problem. But I need your help. Plese inform me how can i know these:

                  1.CurrentBar's session begin and end bar numbers.
                  2.Chart most left and right bar numbers.

                  I try to write the code of my suggestion myself.

                  Thanks.
                  Last edited by aytacasan; 12-01-2010, 10:34 AM.

                  Comment


                    #10
                    aytacasan, you can access the currently applied session template with - http://www.ninjatrader.com/support/h...t7/session.htm, you can then use GetBar() on those DateTime's.

                    The second part is unfortunately not supported to access, please take a look at the mentioned sample codes and how the employ the ChartControls.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Hello,

                      To win the Ninja's DrawLine limitation I draw my lines manually in plot method. This indicator also have some plots too. Now i see my plots not ploting. Is there any other "limitation"? or am i doing something wrong?

                      Thanks.

                      Comment


                        #12
                        Hello again,

                        After to send the post, i explore my code and i decide to call base.plot at top of plot method. And i see ploblem is solved. Yes i know at any object oriented language, if you override base class virtual method via override directive you have to call base method too. But when i explore Ninja's custom plot examples this not doing like this, base class method not calling. Of course by chance this examples not affected from this type usage.

                        IS CALL OF BASE CLASS METHOD REQUIRED FOR OTHER OVERRIDE METHODS(INITIALIZE, ONBARUPDATE OR ONTERMINATION)?

                        Thanks.
                        Last edited by aytacasan; 12-02-2010, 07:38 PM.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Javierw.ok, Today, 04:12 PM
                        0 responses
                        2 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
                        40 views
                        0 likes
                        Last Post alifarahani  
                        Started by Waxavi, Today, 02:10 AM
                        1 response
                        18 views
                        0 likes
                        Last Post NinjaTrader_LuisH  
                        Started by Kaledus, Today, 01:29 PM
                        5 responses
                        15 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Working...
                        X