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 CarlTrading, Yesterday, 09:41 PM
|
1 response
14 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
31 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
30 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|
||
|
Started by CaptainJack, 03-25-2026, 09:53 PM
|
0 responses
34 views
0 likes
|
Last Post
by CaptainJack
03-25-2026, 09:53 PM
|
||
|
Started by CaptainJack, 03-25-2026, 09:51 PM
|
0 responses
19 views
0 likes
|
Last Post
by CaptainJack
03-25-2026, 09:51 PM
|

Comment