so as to avoid the buy,sell sell buy , buy sell churn
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
bars between trades requirment
Collapse
X
-
Hello obwon1,
Thanks for your post.
You could consider using BarsSinceEntryExecution or BarsSinceExitExecution to have the strategy check if at least x number of bars has passed since your last entry or exit.
BarsSinceEntryExecution returns the number of bars that have elapsed since the last entry. When a signal name is provided, the number of bars that have elapsed since that last specific entry will be returned.
BarsSinceExitExecution returns the number of bars that have elapsed since the last exit. When a signal name is provided, the number of bars that have elapsed since that last specific exit will be returned.
See the help guide documentation below for more information and example code.
BarsSinceEntryExecution: https://ninjatrader.com/support/help...yexecution.htm
BarsSinceExitExecution: https://ninjatrader.com/support/help...texecution.htm
Let us know if we may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
&& (BarsSinceExitExecution(0, "", 0) != 0)
I use this, if that helps anyone
But I have a different related question - I would like to do the same with my entry BUT USE A DIFFERENT DATASERIES BAR THAN MY PRIMARY STRATEGY BAR
&& (BarsSinceEntryExecution(0, "", 0) != 0)
so What in the above needs to NOT be 0
thanks
Comment
-
Hello DTSSTS,
Thanks for your note.
You would need to change the value of the barsInProgress argument when calling the BarsSinceEntryExecution() method.
BarsSinceEntryExecution(int barsInProgressIndex, string signalName, int entryExecutionsAgo)
Setting the barsInProgress argument to 0 means that the primary data series would be used. A barsInProgress value of 1 would reference the first additional series added to the script. A barsInProgress value of 2 would reference the second additional series in the script, and so on.
See the help guide documentation below for more information.
BarsSinceEntryExecution: https://ninjatrader.com/support/help...barssinceentry
BarsinProgress: https://ninjatrader.com/support/help...inprogress.htm
Let us know if we may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
Hello DTSSTS,
Thanks for your note.
Yes, that would be considered using a barsInProgressIndex argument of 1 when calling the BarsSinceEntryExecution() method to reference the first additional series added in a script.
BarsSinceEntryExecution(int barsInProgressIndex, string signalName, int entryExecutionsAgo)
BarsSinceEntryExecution(1, "", 0) != 0
Let us know if we may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
it might be better to just remain on primary and just add signal name
Is that the Name of the Trade used as a Label as below as LP1
EnterLong(Convert.ToInt32(DefaultQuantity), @"LP1");
so keeping Primary data would be as below
&& (BarsSinceEntryExecution(0, "LP1", 0) != 0)
Comment
-
Hello DTSSTS,
Thanks for your note.
"it might be better to just remain on primary and just add signal name"
This would ultimately depend on the logic of your script.
The signalName argument for BarsSinceEntryExecution() refers to the signalName given to the entry order as you have described. This could be seen in the Parameters section of the BarsSinceEntryExecution help guide page: "signalName: The signal name of an entry order specified in an order entry method.".
As stated in the BarsSinceEntryExecution help guide page: "When a signal name is provided, the number of bars that have elapsed since that last specific entry will be returned."
Passing a 0 in for the barsInProgressIndex will reference the primary series the script is running on, as stated in my previous post.
See the help guide page for information about using BarsSinceEntryExecution: https://ninjatrader.com/support/help...yexecution.htm
Let us know if we may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
139 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment