Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Time in Trade Display on Chart and Creating a Condition to Exit
Collapse
X
-
Time in Trade Display on Chart and Creating a Condition to Exit
Does anyone know if there is a way to create a variable to calculate how long we have been in the trade and have it count and show on the chart? I have also wanted to calculate the current trade duration and exit if it above the average buy in price and has been longer than 2 hours. I have other time constraints for selling at the end of the day and only limiting trading to certain hours but I do not know if it is similar for this type of ideaTags: None
-
Hello, thanks for writing in. If you are using the strategy builder, there is the "Bars Since Entry" property in the Misc folder that can be printed to the screen. To measure time difference and print it ontot the chart you would need to unlock the script and use the BarTimer example as a reference.
Kind regards,
-ChrisL
-
Hi, thanks for the follow up. No, the bar timer would not work on non time based bars. You would need to record the time of execution using a DateTime object, then measure the time difference between that DateTime object and DateTime.Now (System time) to determine how long the trade has been active.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
71 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
143 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
76 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
47 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
51 views
0 likes
|
Last Post
|

Comment