Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Time between trades
Collapse
X
-
Time between trades
Is there a setting or a script I can add to set s time delay between trades? A few times a day the strategy will try and sell an existing contract and buy a new one in the same candle so I get a margin error and it stops the strategy.Tags: None
-
In OnPositionUpdate, if the position has just changed to flat, note the time by saving DateTime.Now in a variable.
Later, when you are thinking of entering, you could calculate how long it has been since then like this:
int SecondsSinceFlat = (int)Math.Floor((DateTime.Now - FlatTime).TotalSeconds);
- Likes 1
-
Yes - that is a better idea. Chryslertech Do it that way.Originally posted by NinjaTrader_ChrisL View PostHi, you can also use BarsSinceExitExecution() to keep everything in OnBarUpdate, it would also work in historical mode (DateTime.Now references the real time PC clock):
https://ninjatrader.com/support/help...texecution.htm
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
88 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
134 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
118 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
67 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment