Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Adding Strategy start/stop time in menu.
Collapse
X
-
Adding Strategy start/stop time in menu.
On the "edit startegy" menu i would like to add the ability to change the start/stop time of my strategies. I know this has to be done in the unlocked version of my code. Is their a template available for this ?Tags: None
-
Hello Teebone21,
Thanks for your post.
You will need to create a User Defined Inputs for integers and then use those inputs to control logic using ToTime.
An example that uses ToTime can be found here - https://ninjatrader.com/support/help...to_limit_t.htm
ToTime documentation can be found here - https://ninjatrader.com/support/help...t8/?totime.htm
Information on creating User Defined Inputs can be found here - https://ninjatrader.com/support/help...d_input_pa.htm
You may also use a New Indicator/New Strategy Wizard to create User Defined Inputs and see the resulting syntax.
New NinjaScript Wizards - https://ninjatrader.com/support/help.../ns_wizard.htm
We look forward to asisting.
- Likes 1
-
Comment
-
try this:
Code:protected override void OnStateChange() { if (State == State.SetDefaults) { Startzeit1 = DateTime.Parse("01:00", System.Globalization.CultureInfo.InvariantCulture); Endzeit1 = DateTime.Parse("22:00", System.Globalization.CultureInfo.InvariantCulture); } }Code:protected override void OnBarUpdate() { if (Times[0][0].TimeOfDay >= Startzeit1.TimeOfDay && Times[0][0].TimeOfDay <= Endzeit1.TimeOfDay) { ...your logic here... }Code:Properties [NinjaScriptProperty] [PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")] [Display(Name = "Session Start 1", Description = "Handelsstart Lokalzeit", Order = 1, GroupName = "Trading Session")] public DateTime Startzeit1 { get; set; } [NinjaScriptProperty] [PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")] [Display(Name = "Session End 1", Description = "Handelsschluss Lokalzeit", Order = 2, GroupName = "Trading Session")] public DateTime Endzeit1 { get; set; }
- Likes 2
Comment
-
Yes sir thanks !!!!Originally posted by sidlercom80 View Posttry this:
Code:protected override void OnStateChange() { if (State == State.SetDefaults) { Startzeit1 = DateTime.Parse("01:00", System.Globalization.CultureInfo.InvariantCulture); Endzeit1 = DateTime.Parse("22:00", System.Globalization.CultureInfo.InvariantCulture); } }Code:protected override void OnBarUpdate() { if (Times[0][0].TimeOfDay >= Startzeit1.TimeOfDay && Times[0][0].TimeOfDay <= Endzeit1.TimeOfDay) { ...your logic here... }Code:Properties [NinjaScriptProperty] [PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")] [Display(Name = "Session Start 1", Description = "Handelsstart Lokalzeit", Order = 1, GroupName = "Trading Session")] public DateTime Startzeit1 { get; set; } [NinjaScriptProperty] [PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")] [Display(Name = "Session End 1", Description = "Handelsschluss Lokalzeit", Order = 2, GroupName = "Trading Session")] public DateTime Endzeit1 { get; set; }
- Likes 1
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
43 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
21 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
30 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
50 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
41 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment