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

DrawText in 2nd Panel above volume bar

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

    DrawText in 2nd Panel above volume bar

    Hi,

    Using and modifying the VolumeUpDown indicator....

    The indicator is in a new Panel...Panel 2

    I want to write text above each volume bar and eventually under certain conditions...

    My code is this....

    protectedoverridevoid Initialize()
    {
    Add(
    new Plot(new Pen(Color.Lime, 2), PlotStyle.Bar, "UpVolume"));
    Add(
    new Plot(new Pen(Color.Red, 2), PlotStyle.Bar, "DownVolume"));
    Add(
    new Line(Color.DarkGray, 0, "Zero line"));
    }

    protectedoverridevoid OnBarUpdate()
    {
    if (Close[0] >= Open[0])
    {
    Values[
    0].Set(Volume[0]);
    Values[
    1].Reset();
    cntrGreen=cntrGreen +
    1; //Declared variable earlier
    cntrRed=
    0;

    // Draw number above Volume bar.
    DrawText("Volume" + CurrentBar,false,cntrGreen.ToString(),0,Volumebar?,0,Color.Blue,new Font("Arial",7,FontStyle.Regular),
    StringAlignment.Center,Color.Empty,Color.Blue,
    5);


    }
    else
    {
    Values[
    1].Set(Volume[0]);
    Values[
    0].Reset();
    cntrRed=cntrRed +
    1;
    cntrGreen=
    0;
    }

    I'm not sure how to access the Panel2 to write the text above the completed volume bar?


    Help would be appreciated

    Thanks
    Bruce


    Last edited by tacticaltrader; 09-23-2011, 08:21 AM.

    #2
    Hello tacticaltrader,

    Indicators can only be applied to 1 panel at a time. To have it default to its own panel, can set Overlay property to false.

    They can draw in either their own panel or the price panel. This is controlled with DrawOnPricePanel property. Set that to false if you want it to draw in the indicator panel.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      OK thanks..that worked

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,789 views
      0 likes
      Last Post aligator  
      Started by Jimmyk, 01-26-2018, 05:19 AM
      6 responses
      837 views
      0 likes
      Last Post emuns
      by emuns
       
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,293 views
      1 like
      Last Post jgualdronc  
      Started by Touch-Ups, Today, 10:36 AM
      0 responses
      13 views
      0 likes
      Last Post Touch-Ups  
      Started by geddyisodin, 04-25-2024, 05:20 AM
      11 responses
      63 views
      0 likes
      Last Post halgo_boulder  
      Working...
      X