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
-
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 futurenow, 12-06-2021, 05:49 PM
|
18 responses
868 views
0 likes
|
Last Post
![]()
by dj0ntz
Yesterday, 05:14 PM
|
||
Started by TurkeyAngola, Yesterday, 04:44 AM
|
0 responses
18 views
0 likes
|
Last Post
![]()
by TurkeyAngola
Yesterday, 04:44 AM
|
||
Started by abelsheila, 05-14-2025, 07:38 PM
|
2 responses
55 views
0 likes
|
Last Post
![]()
by hglover945
05-16-2025, 03:48 PM
|
||
Started by nailz420, 05-14-2025, 09:14 AM
|
1 response
107 views
0 likes
|
Last Post
|
||
Started by NinjaTrader_Brett, 05-12-2025, 03:19 PM
|
0 responses
508 views
1 like
|
Last Post
|
Comment