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, 07: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 jhjhawkins, Today, 02:57 PM
      1 response
      9 views
      0 likes
      Last Post Lancer
      by Lancer
       
      Started by aaadetos, Today, 06:46 PM
      0 responses
      1 view
      0 likes
      Last Post aaadetos  
      Started by daywalker1970, Today, 04:44 PM
      0 responses
      14 views
      0 likes
      Last Post daywalker1970  
      Started by kaywai, Today, 02:40 PM
      0 responses
      25 views
      0 likes
      Last Post kaywai
      by kaywai
       
      Started by Angus7, Today, 06:03 AM
      2 responses
      53 views
      0 likes
      Last Post Angus7
      by Angus7
       
      Working...
      X