Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Warning: I've been asked to remind all that "Unsupported" means this may break in a future release. Or might not work with other aspects of the program eg Analyzer etc. Use this insight with caution, it is not documented.
Thanks everyone.
I used .NET reflection to rip out all the Methods, Properties etc.
I can state with confidence that there are only 3 extra serialisation methods provided by Ninja above that which comes standard with .NET.
They are :-
NinjaTrader.Gui.Design.SerializableColor
NinjaTrader.Gui.Design.SerializableFont
NinjaTrader.Gui.Design.SerializablePen
Pen seems to work differently so get confident with the others first.
On Serialising the File Object.
Clearly not difficult to parse the properties into a Parameter & use XMLSerialise & StreamWriter to create my own serialization class. But unlike the Color & Font it doesn't appear that the Ninja properties dialog is designed to handle the File Objects properties. So hooking it up the FileOpen dialog looked like it would make the indicator too hard to install on other peoples machines. As getting an "easy to change property value" experience wa what I was going for. Its back to the drawing board.
I hope you find the code below useful.
Partial code walking you thru the step to use build-in Ninja Serialization.
Step 1 - Declare local Variables
#region Variables
// Wizard generated variables
private float yOffset = 15; // Gap up from the bottom of the Panel
private Color textColor = Color.Black;
// User defined variables (add any user defined variables below)
//----------< Text for Y Axis Labels >--------------------
StringFormat stringFormat = new StringFormat();
private SolidBrush textBrush = new SolidBrush(Color.Black);
private Font textFont = new Font("Arial", 8);
#endregion
[Description("Y Offset of text from Bottom of Panel")]
[Category("Parameters - Font")]
[Gui.Design.DisplayName("Text Position")]
public float YOffset
{
get { return yOffset; }
set { yOffset = Math.Min(Math.Max(0,value),1000); }
}
[Browsable(false)]
public string MyFontSerialize
{
get { return NinjaTrader.Gui.Design.SerializableFont.ToString(textFont); }
set { textFont = NinjaTrader.Gui.Design.SerializableFont.FromString (value); }
}
[XmlIgnore()]
[Description("Font of Bar Numbers")]
[Gui.Design.DisplayName("Text Font")]
[Category("Parameters - Font")]
public System.Drawing.Font TextFont
{
get { return textFont; }
set { textFont = value; }
}
[Browsable(false)]
public string TextColorSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(textColor); }
set { textColor = NinjaTrader.Gui.Design.SerializableColor.FromStrin g(value); }
}
[XmlIgnore()]
[Description("Color of Bar Numbers")]
[Category("Parameters - Font")]
[Gui.Design.DisplayName("Text Color")]
public Color TextColor
{
get { return textColor; }
set { textColor = value; }
}
#endregion
Step 4 - Use it Somewhere
public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
{
// ---< ensure you call the base Plot Method prior to exiting this method >---
base.Plot(graphics, bounds, min, max);
// ===< Determine where Text will be displayed.Bottom of the Price Chart >===
float y = bounds.Top + bounds.Height - yOffset - textFont.Height;
graphics.DrawString( "CB-cntBar", textFont, textBrush, bounds.Left, y, stringFormat);
// ---< For each bar that is displayed on the screen >---
for(int cntBar = ChartControl.FirstBarPainted; cntBar <= ChartControl.LastBarPainted; cntBar++)
{
// if (!ChartControl.ShowBarsRequired && cntBar < BarsRequired)
// continue;
From time to time I'm getting unable to save due to indicator is not "serialized", in NT7. This happens with GOMI indicators. Most recently it is the GomRecorderIndicator. Works just fine. I have it set up as instructed, then, out of the blue, at end of day when I go to save all workspaces I get serialized error message. What do I need to do to correct this error. NT tech instructs to delete .xml file?
Here's the new major release of GomPackage, released this time in Elite because it was a lot of hard work.
THIS VERSION IS FOR NT 7 ONLY
Indicators developed with GomRecorder 1.3 still work on 2.0
Majors changes with 1.3b are the …
Post your question there, along with exact error messages from the log output, and exact version of GomRecorder and any other Gom* indicators you are using.