NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 05-30-2012, 04:20 PM   #1
safetrading
Senior Member
 
Join Date: May 2008
Posts: 221
Thanks: 12
Thanked 2 times in 2 posts
Default Strategy Syntax

I'm using a strategy with this in the Initialize section;

Add(StrategyPlot(0));
StrategyPlot(0).Plots[0].Pen.Color = Color.Lime;
StrategyPlot(0).PanelUI = 3;

I am unable however to find the syntax to designate the plot style (bar, line, etc) and width (1,2, etc) for this plot. Would you please point me in the direction where I can find this?

thanks,

Safetrading
safetrading is offline  
Reply With Quote
Old 05-31-2012, 02:56 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

GM Safetrading, please try with the snippets shown in our tip for adding indicators to strategies - http://www.ninjatrader.com/support/f...ead.php?t=3228
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 05-31-2012, 07:22 AM   #3
safetrading
Senior Member
 
Join Date: May 2008
Posts: 221
Thanks: 12
Thanked 2 times in 2 posts
Default Strategy Syntax

I received the link from you regarding the Plot syntax. It was helpful except for one item. I did not see anything referring to how to designate the PlotStyle, ie, Line, Bar, etc. I tried using the following which was a similar format to the other Pen.XXX, but it did not work;

StrategyPlot(1).Plots[0].Pen.Style = Bar;

I would appreciate it if you could show me this one as well. Thanks again for your assistance.

Safetrading

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
GM Safetrading, please try with the snippets shown in our tip for adding indicators to strategies - http://www.ninjatrader.com/support/f...ead.php?t=3228
safetrading is offline  
Reply With Quote
Old 05-31-2012, 07:27 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

Sorry about missing that part, this could unfortunately not be set / changed this way programmatically. But you could change it for the plot directly in the StrategyPlot indicator itself.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-14-2012, 10:20 PM   #5
reticent67
Junior Member
 
Join Date: Jul 2011
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default

This is most helpful indeed. What would the proper syntax be to change the lable of the plot from StrategyPlot? It gets kind of confusing when all the indicators are the same name.

I tried StrategyPlot(0).Plots[0].Name = "xxx" but nothing seemed to change.
reticent67 is offline  
Reply With Quote
Old 06-14-2012, 10:53 PM   #6
reticent67
Junior Member
 
Join Date: Jul 2011
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default

Also, I've added three indicators to my strategy. The third being a ROC indicator which is a ratio of two other instruments. It plots fine on the chart, but when I try to add a line at the "0" level, it crashes NT.


StrategyPlot(2).Lines[0].Value = 20;
reticent67 is offline  
Reply With Quote
Old 06-15-2012, 04:05 AM   #7
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

reticent67, glad to hear - both items you mentioned would unfortunately not be supported for this technique, please add / change them in the originating indicator you add for display.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-15-2012, 04:29 PM   #8
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,219
Thanks: 24
Thanked 1,231 times in 1,002 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by safetrading View Post
I received the link from you regarding the Plot syntax. It was helpful except for one item. I did not see anything referring to how to designate the PlotStyle, ie, Line, Bar, etc. I tried using the following which was a similar format to the other Pen.XXX, but it did not work;

StrategyPlot(1).Plots[0].Pen.Style = Bar;

I would appreciate it if you could show me this one as well. Thanks again for your assistance.

Safetrading
I believe that for Pens, the style is set with DashStyle, not Style.
koganam is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax tonynt Automated Trading 5 07-11-2011 08:36 AM
Problem of Syntax germano Strategy Development 13 04-02-2009 10:55 AM
Print() syntax stefy General Programming 8 10-08-2008 06:22 PM
Strategy plots. Syntax for referencing lines raz0rback Strategy Development 2 06-15-2008 09:06 AM
Syntax for adding Woodies Pivots to strategy raz0rback Strategy Development 1 06-15-2008 07:54 AM


All times are GMT -6. The time now is 03:26 PM.