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

Tick volume indicator

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

    Tick volume indicator

    Has anyone been able to produce a tick volume indicator (histogram)?
    I can produce a tick counter which gives a text display but I have no idea how to write this info at bar close to a text file and then read it back so that I can get a historical type display.

    I found this somewhere and just manipulated it a little.

    Code:
    public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
    {
    	if (Bars == null)
    		return;
    // Recalculate the proper string size should the chart control object font and axis color change
    if (textBrush.Color != ChartControl.AxisColor || textFont != ChartControl.Font)
    			{
    textBrush.Color = ChartControl.AxisColor;
    textFont = ChartControl.Font;
    
    SizeF size = graphics.MeasureString((CountDown ? "Ticks remaining = %" : "Tick count = %") + Bars.Period.Value, textFont);
    textWidth		= size.Width + 5;
    textHeight		= size.Height + 5;
    
    SizeF noTickSize = graphics.MeasureString("Tick Counter interval", textFont);
    noTickTextWidth = noTickSize.Width + 5;
    noTickTextHeight = noTickSize.Height + 5;
    			}
    
    // Plot the tick count message to the lower right hand corner of the chart
    if (Bars.Period.Id == PeriodType.Tick)
    			{
    double tickCount = ShowPercent ? CountDown ? (1 - Bars.PercentComplete) * 100 : Bars.PercentComplete * 100 : CountDown ? Bars.Period.Value - Bars.TickCount : Bars.TickCount;
    graphics.DrawString((CountDown ? " Ticks remaining = " + tickCount : "Tick count = " + tickCount) + (ShowPercent ? "%" : ""), ChartControl.Font, textBrush, bounds.X + bounds.Width - textWidth, bounds.Y + bounds.Height - textHeight, stringFormat);
    			}
    			else
    graphics.DrawString(Bars.TickCount.ToString(), ChartControl.Font, textBrush, bounds.X + bounds.Width - noTickTextWidth, bounds.Y + bounds.Height - noTickTextHeight, stringFormat);
    		}
    I am really only interested in "today" so I assume I could use streamwriter but it just got confusing ...

    Any help much appreciated.

    #2
    Mindset,

    Unfortunately the Plot() method is beyond the level of support I can offer. For your original question, you could use StreamWriter and write out lines that include your volume and the timestamp. Then when you load the indicator it just cycles through all the lines of your StreamWriter and matches the output based on timestamp written in file vs timestamp on chart.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      any luck on this mindset?

      Comment


        #4
        tick

        Wow that's an old post - sorry I moved on from that - but it looks like I didn't solve it.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by PaulMohn, Today, 03:49 AM
        0 responses
        3 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        10 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        2 views
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Working...
        X