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

Draw any object on any panel

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

    Draw any object on any panel

    Hello,

    I wrote an indicator same as MACD indicator and it has one level that value is zero. I wrote this at BarUpdate method:

    if (CrossAbove(Macd, Zero, 1) || CrossBelow(Macd, Zero, 1))
    DrawText(CurrentBar.ToString(), "Crossed", 0, 0, Color.Black);

    This code is fail, after little effort, i understand DrawText drawing text to price panel. I changed my code like this:

    if (CrossAbove(Macd, Zero, 1) || CrossBelow(Macd, Zero, 1))
    DrawText(CurrentBar.ToString(), "Crossed", 0, Close[0], Color.Black);

    Actually i want to draw circle but firstly i'm trying to draw text object more than simple from circle object. How can i draw text at BarUpdate event via DrawText on osilator type indicator panel that not price panel?

    At the same time i know if i override plot method wich Indicator base class virtual method. I can draw my objects on osilator panel via graphics.DrawXXX(). But I want to learn how can i drawtext on BarUpdate method or Why I can't do this if so?

    Also, could you please tell me Ninja has any series about objects for plot objects automaticly? I mean ObjectSeries plots?

    Best Regards.
    Last edited by aytacasan; 11-14-2010, 06:18 AM.

    #2
    Hi aytacasan,

    You can change the panel for plotting with DrawOnPricePanel: http://www.ninjatrader-support.com/H...awPriceOnPanel
    TimNinjaTrader Customer Service

    Comment


      #3
      Hi,

      Is DrawOnPricePanel working same as flag? I mean suppose, I'm writing indicator that shows divergence via draw line both my macd idicator and price chart. So i need first draw line on macd 2 pivot lows then draw line price chart 2 pivot lows if thehe is divergence.

      Also, could you please tell me Ninja has any series about objects for plot objects automaticly? I mean ObjectSeries plots?

      Thanks.

      Comment


        #4
        You would then need to construct 2 indicators, setting DrawOnPricePanel dynamically is unfortunately not supported.

        I'm not sure what you mean by your second question - for NT7 we've introduced the PlotColors / BarColor series.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi,

          Thanks for your response. I think, this is not good solution, but i understand you, with Ninja's infrastructure not allow do this. Ok so it can be a suggestion? I mean suppose draw methods have panel parameter too? So:

          DrawText(panel0,....); // Draw text indicator panel.
          DrawText(panel1,....); // Draw text price panel.
          DrawText(panel2,....); // Draw text other indicator panel.

          Is it possible for Ninja's next releases? If so have can i notify Ninja's developer team about this suggestion?

          THANKS.

          Comment


            #6
            Thanks for your suggestion aytacasan, we'll add it to our feedback list.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              So nice, all of for better Ninja. Thanks again.
              Last edited by aytacasan; 11-15-2010, 12:00 PM.

              Comment


                #8
                In the meantime i asked question about Objects. For clarify we have boolseries, dataseries etc. When we add any series to indicator series have chart.bars count members. Like this Ninja has ObjectSeries class? Each member is object and has bars.count element too when after add to chart.

                Comment


                  #9
                  aytacasan,

                  I unfortunately did not quite follow your question about objects, but I think you are asking if objects like BoolSeries or DataSeries have the same number of elements as the Bars object. The answer to that is yes, they will have the same number as the series it is synced to which is for most cases the primary series of the chart.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi Josh,

                    Actually my question is simple but my english is not enough for telling you my problem. Sory about that.
                    In Ninja we can use many type of series boolseries collection of bool, dataseries collection of double etc. Like this, has ninja objectseries that members is any object.

                    If there is an objectseries, i'll use it like this:

                    class XXX:Indicator
                    variables
                    ObjectSeries os = null;
                    initialize()
                    ObjectSeries os = new ObjectSeries(this);
                    OnBarUpdate()
                    os.Set(0, new TextObject(....));

                    Thanks.

                    Comment


                      #11
                      There's no general object collection available, however for drawing objects that implement the IDraw interface we added accessing the DrawObjects collection in our NT7 - http://www.ninjatrader.com/support/h...rawobjects.htm
                      BertrandNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by algospoke, Yesterday, 06:40 PM
                      2 responses
                      23 views
                      0 likes
                      Last Post algospoke  
                      Started by ghoul, Today, 06:02 PM
                      3 responses
                      14 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by jeronymite, 04-12-2024, 04:26 PM
                      3 responses
                      45 views
                      0 likes
                      Last Post jeronymite  
                      Started by Barry Milan, Yesterday, 10:35 PM
                      7 responses
                      22 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by AttiM, 02-14-2024, 05:20 PM
                      10 responses
                      181 views
                      0 likes
                      Last Post jeronymite  
                      Working...
                      X