Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Rays, Lines, Fibos as default
Collapse
X
-
Fingerman,
To make a script run with a default setting you would set that brush/property in OnStateChange() inside State.SetDefaults.
OnStateChange() can be used to filter out different stages of the entire life cycle of a script (SetDefaults, Configure, Historical, Realtime, Terminated, etc.) OnStateChange() is fully covered in the Help Guide here:
The following snippet demonstrates how you would properly set a brush default in your script, along with the public property for the brush that allows the brush to be changed from the indicators settings.
Code:protected override void OnStateChange() { if (State == State.SetDefaults) { MyBrush = Brushes.Orange; } } [NinjaScriptProperty] [XmlIgnore] [Display(Name="MyBrush", Order=1, GroupName="Parameters")] public Brush MyBrush { get; set; } [Browsable(false)] public string MyBrushSerializable { get { return Serialize.BrushToString(MyBrush); } set { MyBrush = Serialize.StringToBrush(value); } }
I suggest using the NinjaScript wizard to generate your inputs or plots so that you can simply copy/paste the public property into your code.Josh G.NinjaTrader Customer Service
Comment
-
Hello Fingerman,
Thank you for your response.
My colleague replied for a NinjaScript indicator. To set the defaults of Drawing Objects you need to double click on the object after drawing it --> set the desired options --> and then select 'template' at the bottom right hand corner of the Drawing Objects window --> select 'save' --> name the template 'Default' --> Save --> OK.
For information on Drawing Objects please visit the following link: https://ninjatrader.com/support/help..._tools__ob.htm
Please let me know if you have any questions.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rbeckmann05, Yesterday, 06:48 PM
|
1 response
12 views
0 likes
|
Last Post
by bltdavid
Today, 05:43 AM
|
||
Started by llanqui, Today, 03:53 AM
|
0 responses
6 views
0 likes
|
Last Post
by llanqui
Today, 03:53 AM
|
||
Started by burtoninlondon, Today, 12:38 AM
|
0 responses
10 views
0 likes
|
Last Post Today, 12:38 AM | ||
Started by AaronKoRn, Yesterday, 09:49 PM
|
0 responses
15 views
0 likes
|
Last Post
by AaronKoRn
Yesterday, 09:49 PM
|
||
Started by carnitron, Yesterday, 08:42 PM
|
0 responses
11 views
0 likes
|
Last Post
by carnitron
Yesterday, 08:42 PM
|
Comment