![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2007
Posts: 187
Thanks: 0
Thanked 1 time in 1 post
|
Hello,
I hacked together this indicator (not knowing what I am doing). I almost have it plotting the way I want it but I am missing one part that I can't figure out. I am trying to get it to shade both zones ( 2-3 std above and below an ema). See attached. I can only get the top zone shaded. Can anyone shed some light on how to shade the bottom zone? Thanks for the help, Tommy |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Please disregard the Plot override method. Use DrawRegion() method available in NinjaTrader 6.5.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2007
Posts: 187
Thanks: 0
Thanked 1 time in 1 post
|
Thanks for the reply. Do you know if there is any example code of how it would be done? I don't know much about programming, I just pasted a bunch of code together and kept tweaking it until it compiled and displayed correctly
.Thanks |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Please see the Reference Samples section in the forums: http://www.ninjatrader-support.com/v...ead.php?t=4331
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Nov 2007
Posts: 187
Thanks: 0
Thanked 1 time in 1 post
|
Thanks for the info. I have it working with "DrawRegion"
In the example script the color settings and opacity settings are hard coded. Is it possible to make them user definable? |
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
You can do that just like how you would do any other variable. Please see other indicators like the SMA on how to get user definable variables.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Nov 2007
Posts: 187
Thanks: 0
Thanked 1 time in 1 post
|
I have another question. I have the indicator working except every time I close and reopen NT the DrawRegion color defaults back to the default even though I changed it on the chart. I guess I missed something but i'm not sure what. Any ideas?
#region Variables private int period = 34; private Color FillColor = Color.Blue; private Color XMAColor = Color.Transparent; #endregion DrawRegion("XMA Zone", CurrentBar, 0, EMA( High, Period ), EMA( Low, Period ), XMAColor, FillColor, 2); Thanks |
|
|
|
|
|
#8 |
|
Junior Member
|
Is it possible to set 'Right side margin' to a high number (e.g., 40) and draw items in the space between the last price bar and the right side of the chart (e.g., DrawRectangle)?
|
|
|
|
|
|
#9 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
tommyjames: The colors will be the defaults every time you use the indicator again. If you want different default colors, change it in the Variable section.
spenbm01: You currently cannot programmatically draw in the right hand region, but you can do it manually through the chart draw tools.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Nov 2007
Posts: 187
Thanks: 0
Thanked 1 time in 1 post
|
Yes I understand that they will be defaults when I add the indicator to a chart but the colors default back on an existing chart with the indicator already on it. It is the only indicator that does this, so there must be something missing in the code.
Thanks |
|
|
|
|
|
#11 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
I didn't notice anything off the bat. If you could post the indicator I can take a quick look for you to see if there truly isn't anything out of place.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#12 |
|
Senior Member
Join Date: Nov 2007
Posts: 187
Thanks: 0
Thanked 1 time in 1 post
|
Here is the indicator....
|
|
|
|
|
|
#13 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
tommyjames,
Try serializing your color parameter. After your XMA Color in the "Properties" section add this Code:
[Browsable(false)]
public string XMAColorSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(XMAColor); }
set { XMAColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#14 |
|
Senior Member
Join Date: Nov 2007
Posts: 187
Thanks: 0
Thanked 1 time in 1 post
|
Thanks for the reply. I put the code in but it still behaves the same.....
Is this a new section or is it in place of the existing section? Any more ideas? Thanks
Last edited by tommyjames; 04-07-2008 at 11:17 AM.
|
|
|
|
|
|
#15 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Try adding one for the FillColor also.
These should be new sections in the Properties region of your code. That region should look like this: Code:
/// <summary>
/// </summary>
[XmlIgnore()]
[Description("Zone Color")]
[Category("Colors")]
[Gui.Design.DisplayNameAttribute("Zone Color")]
public Color fillColor
{
get { return FillColor; }
set { FillColor = value; }
}
[Browsable(false)]
public string FillColorSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(FillColor); }
set { FillColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
/// <summary>
/// </summary>
[XmlIgnore()]
[Description("XMA Color")]
[Category("Colors")]
[Gui.Design.DisplayNameAttribute("XMA Color")]
public Color xMAColor
{
get { return XMAColor; }
set { XMAColor = value; }
}
[Browsable(false)]
public string XMAColorSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(XMAColor); }
set { XMAColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
/// <summary>
/// </summary>
[Description("Numbers of bars used for calculations")]
[Category("Parameters")]
public int Period
{
get { return period; }
set { period = Math.Max(1, value); }
}
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Choice of Time Zone | Wajodi | Suggestions And Feedback | 19 | 10-23-2008 12:55 AM |
| Time Zone for NT charts | kgillis23 | Strategy Development | 10 | 01-19-2008 05:20 PM |
| Code->test/debug->change code->retest ... cycle process | bbarroux | Strategy Development | 3 | 10-02-2007 12:44 PM |
| Zone Alarm popup? | RTS Trading | Automated Trading | 2 | 05-04-2007 09:33 AM |
| Shading areas of chart? | higler | Charting | 3 | 05-01-2007 07:58 AM |