NexusFi: Find Your Edge


Home Menu

 





Formatting the Y-Axis


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 5 posts (4 thanks)
    2. looks_two timmyb with 4 posts (2 thanks)
    3. looks_3 Trader.Jon with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 8,984 views
    2. thumb_up 8 thanks given
    3. group 5 followers
    1. forum 12 posts
    2. attach_file 4 attachments




 
Search this Thread

Formatting the Y-Axis

  #1 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

I am currently trying to format the y-axis of the indicator panel of a NinjaTrader chart and have not found a solution. Here comes the first of my current problems:

(1) Indicator that displays the NOB spread. The NOB spread shall be displayed in '32 similar to the bond quotes.

The price marker can be correctly formatted by overriding FormatPriceMarker(), but how can I format the Y axis?




(2) I have a similar problem for the Heiken-Ashi indicator.

How can I format the Y axis for the lower panel to display pips instead of 2 decimal places?


Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
GFIs1 1 DAX trade per day journal
11 thanks
HumbleTraders next chapter
11 thanks
  #3 (permalink)
 timmyb 
duluth,mn
 
Experience: Advanced
Platform: ninja,thinkorswim
Broker: Amp-Zenfire
Trading: ES,Options
Posts: 654 since Feb 2010
Thanks Given: 81
Thanks Received: 1,361


I am unsure but is there something in chartcontrols that will control the y axis?? I am no expert I will see what i can find to help you out.

Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 timmyb 
duluth,mn
 
Experience: Advanced
Platform: ninja,thinkorswim
Broker: Amp-Zenfire
Trading: ES,Options
Posts: 654 since Feb 2010
Thanks Given: 81
Thanks Received: 1,361

The only thing i can readily think of is to right click the right margin and adjust the properties

Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


timmyb View Post
The only thing i can readily think of is to right click the right margin and adjust the properties

But the properties don't let you select the format of the legend for the axis?

Started this thread Reply With Quote
  #6 (permalink)
 timmyb 
duluth,mn
 
Experience: Advanced
Platform: ninja,thinkorswim
Broker: Amp-Zenfire
Trading: ES,Options
Posts: 654 since Feb 2010
Thanks Given: 81
Thanks Received: 1,361


Fat Tails View Post
But the properties don't let you select the format of the legend for the axis?

if you go from auto to manual, then you could override i think. Still looking into it further

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #7 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


timmyb View Post
if you go from auto to manual, then you could override i think. Still looking into it further

In manual mode you can fix the upper and lower margin, but I did not see any option to format the numbers.


Actually I would like to access the formatting of the indicator axis via code.


The price marker on the axis could be formatted, although this formatting currently shifts the y-axis:

https://forum.ninjatrader.com/showthread.php?t=36377


However, I did not find a possibility to format the axis itself.

Started this thread Reply With Quote
  #8 (permalink)
 timmyb 
duluth,mn
 
Experience: Advanced
Platform: ninja,thinkorswim
Broker: Amp-Zenfire
Trading: ES,Options
Posts: 654 since Feb 2010
Thanks Given: 81
Thanks Received: 1,361

ChartControl.HasRightYAxis =true;

tried that but it says it is only read only

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #9 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

I just throw this one in here, maybe it helps or not.

Attached Files
Elite Membership required to download: PP_VerticalScale.cs
Reply With Quote
Thanked by:
  #10 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


I have not solved the original scale problem, but found the solution to another small NinjaTrader bug.

If you take a default bond or treasury chart, for example ZB 03-11 or ZN 03-11. and apply an indicator such as a simple EMA, you will observe

- that the price marker of the EMA does not show a correct value
- that the y-axis of the chart is shifted to the left

This can be avoided, if you add the following code to every (!) indicator, which is overlaid on panel 1 of the chart.


 
Code
public override string FormatPriceMarker(double price)
{
	double truncatedPart = Math.Truncate(price);
	int fractionalPart = Convert.ToInt32(320 * Math.Abs(price - truncatedPart) - 0.0001); // rounding down for ZF and ZT
	string fraction = "";
	string priceMarker = "";
	if (TickSize == 0.03125) 
	{
		fractionalPart = fractionalPart / 10;
		fraction = fractionalPart.ToString();
		if (fractionalPart < 10)
			fraction = "'0" + fraction;
		else 
			fraction = "'" + fraction;
		priceMarker = truncatedPart.ToString() + fraction;
	}
	else if (TickSize == 0.015625 || TickSize == 0.0078125)
	{
		fraction = fractionalPart.ToString();
		if (fractionalPart < 10)
			fraction = "'00" + fraction;
		if (fractionalPart < 100)
			fraction = "'0" + fraction;
		else	
			fraction = "'" + fraction;
		priceMarker = truncatedPart.ToString() + fraction;
	}
	else
		priceMarker = price.ToString(Gui.Globals.GetTickFormatString(TickSize));
	return priceMarker;
}
If have added this piece of code to the default EMA. Now the price marker is correct and the y-axis does not shift. The modified indicator is attached below.

I think that NT will address the bug in one of the next releases. We don't want to recode all indicators, do we?

Attached Thumbnails
Click image for larger version

Name:	ZN 03-11 (15 Min) 21_01_2011 indicator.jpg
Views:	204
Size:	116.6 KB
ID:	28934   Click image for larger version

Name:	ZN 03-11 (15 Min) 21_01_2011 correct.jpg
Views:	193
Size:	113.2 KB
ID:	28935  
Attached Files
Elite Membership required to download: EMAmod.zip
Started this thread Reply With Quote
Thanked by:




Last Updated on January 26, 2011


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts