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 sukhob, 05-18-2023, 08:26 PM
|
2 responses
127 views
0 likes
|
Last Post
by TraderJA
Today, 01:45 AM
|
||
Started by timwey, Yesterday, 10:55 AM
|
4 responses
23 views
0 likes
|
Last Post
by timwey
Yesterday, 09:33 PM
|
||
Started by DJ888, 06-28-2024, 10:18 PM
|
3 responses
39 views
0 likes
|
Last Post
by AdamDJ8
Yesterday, 08:24 PM
|
||
Started by ntwong, Yesterday, 08:22 PM
|
0 responses
16 views
0 likes
|
Last Post
by ntwong
Yesterday, 08:22 PM
|
||
Started by Sigma Cypher, 01-08-2022, 06:56 AM
|
9 responses
1,170 views
0 likes
|
Last Post
by Tbryant
Yesterday, 08:03 PM
|
Comment