View Full Version : DrawRegion
Hi, I'm trying to code a simple color region and am having no luck at all. I am sure I am overlooking something simple, but can't see it. What I am trying to do is if the Stochastics is above 80, then shade the Stochastics area one color and if under 20 shade it a different color. So far, I can't get any shading at all. The code I have is below:
double retvalue = Stochastics(Close, 5, 15,5).K[0];
if(retvalue > 80) {
DrawRegion("tag1",CurrentBar,0,Stochastics(5,15,5).K,20,Color.Fores tGreen, Color.ForestGreen, 5);
}
if(retvalue < 20) {
DrawRegion("tag2",CurrentBar,0,Stochastics(5,15,5).K,20,Color.Red , Color.Red, 5);
}
Any help would be greatly appreciated!
Thanks,
jrs
NinjaTrader_Ray
04-07-2008, 12:04 PM
Any error messages in the log?
How about just starting off with a simple DrawRegion() call to ensure that this works. Then add some of the conditional logic.
No there are not any error messages pertaining to this (DrawRegion).
As you suggested (good idea), I simplified it down to:
DrawRegion("XMA Zone", CurrentBar, 0, EMA( High, 10 ), EMA( Low, 10 ), Color.Green, Color.Green, 2);
And I do get a plot on the top graph (in the candlesticks). So that part does work, however, I think my problem may be it will not show in the subgraphs, in the actual Stochastic plotted area perhaps?
Thanks!
Jim
NinjaTrader_Ray
04-07-2008, 07:57 PM
See the DrawOnPricePanel property.
http://www.ninjatrader-support.com/HelpGuideV6/DrawPriceOnPanel.html
Thanks Ray, works fine now.
rcsingleton
04-14-2008, 11:12 PM
Question.
I want to draw arrows on top of indicator bars in a second panel. Will that work if I set 'overlay = false' in the initialize section ?
Is there a restriction such that only drawing objects can be placed on top of charts, or can they also be drawn on top of indicators bars ?
Can you point me to any example code ?
Regards,
R. C.
NinjaTrader_Josh
04-15-2008, 01:57 AM
Off the top of my head I believe on default the draw objects will appear in whichever panel your indicator is running on. You can change the draw objects to appear in the price panel by setting DrawOnPricePanel to true.
If my memory is wrong then set DrawOnPricePanel to false and it will have the draw objects appear in the indicator panel.