Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Price marker format for T-Notes Futures Pivot Points
Collapse
X
-
Hello,
I wonder if in this situation a solution was developed.
Originally posted by NinjaTrader_RyanM View PostHello Ricam,
Currently, you would have to use multiple indicators as FormatPriceMarkers() will apply to all charts. There would have to be a change here to allow different format per plot. Thank you for taking the time to provide us with valuable feedback, we have inserted your suggestion into our tracking system and assigned it ID # 715.
Originally posted by Ricam View PostOnce again am requesting a way to do the following:
In an indicator that has more than one plot, to be able to use FormatPriceMarker to display properly formatted values for all of the plots, not just one.
I believe there would have to be different FormatPriceMarker statements for each of the plots, not sure if that can be done.
Can anyone can figure out a way to do this, Thanks
Thanks in advance,
Comment
-
With regards to different labels for multiple plots in an indicator, would it be possible to return a global string whose value had been set just prior to the call to FormatPriceMarker() ?
there would need to be some what to determine when FormatPriceMarker() is being called. Does it get called, for example, immediately after a Plot.set() ? or if not, is there any other way to determine the timing or some other trigger?
Thanks,
Will.
Comment
-
Different Price Marker Format or Label for each of multiple plots
Currently, you would have to use multiple indicators as FormatPriceMarkers() will apply to all charts. There would have to be a change here to allow different format per plot. Thank you for taking the time to provide us with valuable feedback, we have inserted your suggestion into our tracking system and assigned it ID # 715.
Ekann, Ryan's comment would unfortunately still apply here. I have made sure your request for his enhancement id is tracking in our lists as well though.
Just iterate through the list of Values and find the one that matches the current price that is being fed into the FormatPriceMarker method. Then customize the return value for that particular price.
It's always a good idea to put try/catch error trapping in the FormatPriceMarker method. Just take my word for it.Last edited by Ricam; 01-14-2015, 11:09 AM.
Comment
-
Originally posted by Harry View PostI have now modified the indicator code of the EMA to address the problem - but, then I would have to add that piece of code to all my indicators to make them display properly on bond and treasury note futures.
I, too, found that treasury futures (eg, ZB, ZF, ZN, ZT, et al) show indicator price markers that don't match the format of the chart prices displayed on the Y axis. That is, the Y axis shows neatly formatted treasury prices with an apostrophe, but every indicator (when applied to a treasury futures chart) shows its price marker(s) with a decimal point. This makes for an annoying mish-mash of price formats that clash visually, and (as noted elsewhere) shifts the Y axis slightly to the left to make room for the long-ish decimal formatted treasury price from the indicator.
To solve this problem for *all* indicators, I added these 3 functions to bin/Custom/Indicators/UserDefinedMethods.cs,
Code:public double Round2TickSize(double Price) { return Instrument.MasterInstrument.Round2TickSize(Price); } public string FormatPrice(double Price) { return Instrument.MasterInstrument.FormatPrice(Round2TickSize(Price)); } public override string FormatPriceMarker(double Price) { return FormatPrice(Price); }
How can it do this? Because these methods are defined in UserDefinedMethods.cs, they provide a simple and consistent custom default FormatPriceMarker() for every indicator derived from the "Indicator" base class. This new default FormatPriceMarker() produces a correctly formatted price for every instrument in all cases.
I've attached my UserDefinedMethods.cs with these 3 functions.Attached FilesLast edited by bltdavid; 03-16-2017, 10:21 PM.
Comment
-
Basically this simplifies the code for correctly formatting indicators in overlay mode to:
Code:public override string FormatPriceMarker(double price) { return Instrument.MasterInstrument.FormatPrice(Instrument.MasterInstrument.Round2TickSize(price)); }
Comment
-
Originally posted by Harry View PostBasically this simplifies the code for correctly formatting indicators in overlay mode to:
Code:public override string FormatPriceMarker(double price) { return Instrument.MasterInstrument.FormatPrice(Instrument.MasterInstrument.Round2TickSize(price)); }
Comment
-
The Missing Manual
Archived here for posterity is a document explaining how to achieve a full solution.
Written for the non-programmer, inexperienced user who has no idea what to "do" with the solution discussed in this thread, this 2-page document will explain the missing steps.
See attached file.
Enjoy!Attached Files
Comment
-
Originally posted by Harry View PostBasically this simplifies the code for correctly formatting indicators in overlay mode to:
Code:public override string FormatPriceMarker(double price) { return Instrument.MasterInstrument.FormatPrice(Instrument.MasterInstrument.Round2TickSize(price)); }
and I updated my "bin\Custom\Indicator\UserDefinedMethods.cs" to this,
Code:#region Using declarations using System; using System.ComponentModel; using System.Drawing; using NinjaTrader.Cbi; using NinjaTrader.Data; using NinjaTrader.Gui.Chart; #endregion // This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { /// <summary> /// This file holds all user defined indicator methods. /// </summary> partial class Indicator { public double Round2TickSize(double Price) { return Instrument.MasterInstrument.Round2TickSize(Price); } public string FormatPrice(double Price) { return Instrument.MasterInstrument.FormatPrice(Round2Tick Size(Price)); } public override string FormatPriceMarker(double Price) { return [B][COLOR=#e74c3c]Overlay[/COLOR][/B] ? FormatPrice(Price) : string.Format("{0:0.00}", Price); } } }
panel, so the price markers should be formatted according to the MasterInstrument.
When Overlay is False, such as with indicators like CCI, RSI, MACD, etc, standard
decimal formatting should be used, regardless of the MasterInstrument.
Enjoy!
PS:
The NT8 solution is here.
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by carnitron, Today, 08:42 PM
|
0 responses
4 views
0 likes
|
Last Post
by carnitron
Today, 08:42 PM
|
||
Started by strategist007, Today, 07:51 PM
|
0 responses
6 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,969 views
3 likes
|
Last Post
by jhudas88
Today, 06:59 PM
|
||
Started by rbeckmann05, Today, 06:48 PM
|
0 responses
5 views
0 likes
|
Last Post
by rbeckmann05
Today, 06:48 PM
|
||
Started by rhyminkevin, Today, 04:58 PM
|
4 responses
58 views
0 likes
|
Last Post
by dp8282
Today, 06:13 PM
|
Comment