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 junkone, Today, 11:37 AM
      0 responses
      2 views
      0 likes
      Last Post junkone
      by junkone
       
      Started by quantismo, 04-17-2024, 05:13 PM
      5 responses
      34 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by proptrade13, Today, 11:06 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by love2code2trade, 04-17-2024, 01:45 PM
      4 responses
      34 views
      0 likes
      Last Post love2code2trade  
      Started by cls71, Today, 04:45 AM
      2 responses
      10 views
      0 likes
      Last Post eDanny
      by eDanny
       
      Working...
      X