so as to avoid the buy,sell sell buy , buy sell churn
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 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.Brandon H.NinjaTrader Customer Service
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.Brandon H.NinjaTrader Customer Service
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.Brandon H.NinjaTrader Customer Service
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.Brandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by llanqui, Yesterday, 09:59 AM
|
2 responses
15 views
0 likes
|
Last Post
by llanqui
Today, 04:00 AM
|
||
Started by ThoriSten, Today, 03:56 AM
|
0 responses
2 views
0 likes
|
Last Post
by ThoriSten
Today, 03:56 AM
|
||
Started by PhillT, 04-19-2024, 02:16 PM
|
3 responses
18 views
0 likes
|
Last Post
by mangel2000
Today, 03:04 AM
|
||
Started by TraderBCL, Today, 02:37 AM
|
0 responses
1 view
0 likes
|
Last Post
by TraderBCL
Today, 02:37 AM
|
||
Started by mangel2000, Today, 02:23 AM
|
0 responses
10 views
0 likes
|
Last Post
by mangel2000
Today, 02:23 AM
|
Comment