Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to limit strategy to one trade per day?
Collapse
X
-
How to limit strategy to one trade per day?
I have a strategy that works well--sort of--except that I only want it to take only one trade per day. Any ideas?Tags: None
-
Billy, you'll have to use some sort of a true/false (boolean) flag to check whether or not a trade has been placed already in the day combined with a date/time checker to reset the flag every new day.
Something like this:
Code:// in variables bool alreadyTradedToday = false; OnBarUpdate() { if (CurrentBar < 2) return; if (Time[0].DayOfWeek != Time[1].DayOfWeek) // new day, reset bool flag { alreadyTradedToday = false; } if ([Long Entry Conditions are true] && alreadyTradedToday == false) { alreadyTradedToday = true; EnterLong(); } // same, but opposite for shorts }AustinNinjaTrader Customer Service
-
-
Hello freddy250,
Thank you for your inquiry.
All you would need to do is change Time[0].DayOfWeek and Time[1].DayOfWeek to Time[0].Month and Time[1].Month.
I would suggest looking at this link to learn more about the DateTime structure, which is what a Time[index] returns: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
Please, let us know if we may be of further assistance.Zachary G.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
134 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
75 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
119 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
114 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
92 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment