Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Bars Since Entry/Exit
Collapse
X
-
Hello cupir2,
BarsSinceExitExecution() will return a negative 1 if there have not been any exits.
Below is a public link to the help guide on BarsSinceExitExecution().
In the condition builder compare BarsSinceExitExecution() to a Misc > Numeric value and set the value to -1 to detect if no exit has been placed.
Check for both BarsSinceExitExecution() and BarsSinceEntryExecution() to both have a value of -1 if you are wanting to detect when there have been no trades.Chelsea B.NinjaTrader Customer Service
- Likes 3
Comment
-
Using with strategy and OnBarClose and exit set to trigger as below
(BarsSinceEntryExecution(0, "", 0) > 1)
I want to be clear on when it will execute, I know that bar 0 where the 1 is shown would be the entry bar, when we close that bar then we are on bar 1, so greater than 1 will be when the next bar opens
Question - will the exit order be sent instantly when that bar opens and if back testing the exit will calculate on the Open of that bar as well?
Thanks
Comment
-
Hello DTSSTS,
In backtesting everything is run OnBarClose, the order would be evaluated when the bar close is processed and OnBarUpdate is called. The historical fills would pass through the historical fill engine, you can read about that here: https://ninjatrader.com/support/help...lFillAlgorithm
In a realtime situation and if the strategy is using OnEachTick calculation the order could be sent immediately. If you are using OnBarClose processing then the order will be submitted once the bar closes.
JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rajendrasubedi2023, Today, 09:50 AM
|
3 responses
15 views
0 likes
|
Last Post Today, 10:57 AM | ||
Started by lorem, Today, 09:18 AM
|
2 responses
11 views
0 likes
|
Last Post Today, 10:55 AM | ||
Started by geddyisodin, Today, 05:20 AM
|
4 responses
29 views
0 likes
|
Last Post
by geddyisodin
Today, 10:45 AM
|
||
Started by geotrades1, Today, 10:02 AM
|
2 responses
10 views
0 likes
|
Last Post
by geotrades1
Today, 10:43 AM
|
||
Started by ender_wiggum, Today, 09:50 AM
|
1 response
5 views
0 likes
|
Last Post Today, 10:10 AM |
Comment