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)
I'm working on a new version of SlopeBox that would have multiple MA/slopeboxes in one indicator. It is working well, but only the last drawn box is staying on the screen.....the public SlopeBox (forgot where I found it, probably NexusFi (formerly BMT)) uses .NET methods to draw, not NinjaTrader methods...
graphics.DrawRectangle
graphics.DrawString
For example, the indicator has three different MA, and three different SlopeBoxes. The boxes are drawn in an override to the Plot Method.
Here is the draw code in the Plot override method....for each Plot this is called. Only the last box remains on the screen. The other two appear to be erased as soon as the next one is written.
//the bounds offset is multiplied by the box number to properly position new instances of the SlopeBox
graphics.DrawRectangle
(new Pen(Plots[0].Pen.Color, 2),
bounds.X + bounds.Width - 60,
bounds.Y + bounds.Height - Boxnumber * 40,
46,
22);
StringBuilder strDegrees = new StringBuilder();
strDegrees.Append((degrees).ToString());
strDegrees.Append(Convert.ToChar(0176));
textBrush.Color=degreesColor;
I guess I would be verifying that the boxnumber is working as that is the key to offsetting the boxes from each other. If they are the same number of course will overlay on each other.
Hopefully others can give you more to go on.
Be yourself; everyone else is already taken. Oscar Wilde
yes, the boxnumber is working OK...because if I comment out plot1 and plot2, plot0 will draw its slopebox
if I comment out Plot2 only, then the Plot0 slopebox does not show, but the plot1 slopebox does show. Seems that only the last slopebox written remains.
Ninjatrader draw functions let the coder say whether the prior draw object is erased when a new one is written...but this does not seem to be in the .net methods mentioned
would post the indicator code here but I don't know how to export it...the public enums are in the mother indicator and it won't compile stand alone on the export
I don't have much time to work on this but one thing you can look at is using 3 of:
graphics.DrawRectangle(new Pen(Plots[0].Pen.Color, 2), bounds.X + bounds.Width - 60,bounds.Y + bounds.Height - 2 * 40, 46,22); where boxnumber variable is replaced by the actual number (in this example "2")
Probably the same with the graphics drawstring.
If I can find the time this weekend I'll see how much I can do to help but thought maybe these clues would get you started.
Be yourself; everyone else is already taken. Oscar Wilde
Rather than instantiate a bunch of separate indicators, I want them all in one codeset, for the most part, so that the data is easily shared by one single intelligent algorithm...for example, to know the simultaneous value of three different MA is valuable information. It is easier for a process to have all this information in one place, especially if it is going to be correlated with other live indicators / calculations.