PDA

View Full Version : Display numbers on screen


dowhk
03-01-2010, 12:45 PM
Hi,

How can I display numbers on the screen for the indicators?
I have 4 plots in an indicator panel (panel 2 for example) and want to plot only one of them as a line but other three of them to display as numbers for the last bar instead of lines. I could not do that with the DrawText().

Any help will be greatly appreciated.

NinjaTrader_RyanM
03-01-2010, 01:02 PM
Hello Dowhk,

Thank you for your post.

For a non-programming solution, consider setting the lines to transparent and setting Price Markers to true.

Otherwise using DrawText() is one way to do it. Let us know what you have so far.

Below are some snippets for checking if the bar is the last bar. Different code is used depending on whether CalculateOnBarClose is set to true or false.

When CalculateOnBarClose == false, then OnBarUpdate() is being called for the last bar on the chart:


if (CurrentBar == Bars.Count - 1)
// Is last bar on chart


When CalculateOnBarClose == true, then OnBarUpdate() is being called for the last closed bar on the chart, not the in-process bar:


if (CurrentBar== Bars.Count -2)
// Is last bar on chart

dowhk
03-01-2010, 01:51 PM
Ryan, Thank you very much.

I understand the LastBarOnChart.
I am very new to NT and I don't know how to convert numbers to strings and display them on screen. I could not use the DrawText().

Here is the chart to help my explanation:
There are 4 indicator lines in the panel 2. I want to convert the magenta, cyan, and yellow lines to numbers and disply them on the upper right corner of the panel 2. I want to keep the green line as is but display numbers for others.

Please, give me right directions.

NinjaTrader_RyanM
03-01-2010, 02:09 PM
Hello Dowhk,

You can use ToString() to convert a double value into a string.

myDouble.ToString()

The reference sample below provides more help on working with String objects:

Manipulating String Objects (http://www.ninjatrader-support2.com/vb/showthread.php?t=26359)