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
Minimum bars required condition.
Collapse
X
-
Minimum bars required condition.
When applying any strategy, one of the options in the drop down box is "minimum bars required". I always thought that it was "minimum " since start of market session. However, I see the signals begin with the first bar or well before the 20th bar. How can i fix that? Thanks.Tags: None
-
Hi ju1234,
This input specifies the minimum number of bars before the backtest will start processing fills.
For your needs, you could specify a time filter condition to limit the trading hours of your strategy - http://www.ninjatrader-support2.com/...ead.php?t=3226BertrandNinjaTrader Customer Service
-
I am talking about applying the strategy to the live chart for generating signals (not the backtesting chart). The "minimum bars required" is part of the properties of the chart. The default value is 20. I have used a different number also. Still i notice that sometimes the buy or sell signal is genrated before the 20 bars (20 bars since the session began). The staochastics would not even be valid before at least those many number of bars because the price may be totally higher or lower than the closing time of the chart. Thanks.
Comment
-
ju1234,
If you have min bars = 20 no strategy logic is even triggered until you have 20 bars on the chart. This is not 20 real-time bars. This is just 20 bars on the chart. You can verify this yourself by printing the Time[0] of the first bar that gets processed and match it up with the chart.Josh P.NinjaTrader Customer Service
Comment
-
You mean it is not "20 bars since the start of session" instead it is 20 bars on the entire chart? If that is correct, how can I make it X number of bars since the session start. The time frame in the chart properties does not work because that just starts the chart at a later date.
The reason I am being so particular about this condition is: say the closing price of ES yesterday was 890. Today it opens at 880. The chart is continuous except for a devider line in between. The price change by itself moves the stochastics or other indicator down to the bottom of the range, but it is not a true change and it would trigger a buy although it would be a false signal. Are you with me. Thanks.
Comment
-
Not fully sure I follow - you should have a complete chart including the overnight action when setting your chart session times to 24hrs display.
You could use FirstBarOfSession (http://www.ninjatrader-support.com/H...OfSession.html) in NinjaScript and count your elapsed bars since it returned true.
Or you could add a time filter to your strategy, you could set it for example to trade only from 9:45 - 15:45 to let the market settle when the opening orders come in...
See this reference sample here for details - http://www.ninjatrader-support2.com/...ead.php?t=3226BertrandNinjaTrader Customer Service
Comment
-
Iam also having a similar type of problem. One of the Moving average I use is 50 in my strategy. If i say minimum bars required as 20 none of the trades happen in the strategy but as soon as I make minimum bars required as 50 or more trades start happening. Why is it so ?
Comment
-
NT enhancement request: also log exceptions to Output window by default
Originally posted by kassaindia View PostIam also having a similar type of problem. One of the Moving average I use is 50 in my strategy. If i say minimum bars required as 20 none of the trades happen in the strategy but as soon as I make minimum bars required as 50 or more trades start happening. Why is it so ?
Here's a pattern you can use to quickly see if you are having any runtime errors via the Output window that you might not otherwise be aware of if you are not monitoring actual logs (...\Documents\NinjaTrader 6.5\trace\trace.*.txt):
Code:protected override void OnBarUpdate() { try { //Your code here... } catch (Exception e) { Print(String.Format("Exception message: {0}", e.Message)); Print(String.Format("Exception stack: {0}", e.StackTrace)); if (e.InnerException != null) Print(String.Format("Exception inner stack: {0}", e.InnerException.StackTrace)); throw; } }
Last edited by jdfagan; 06-03-2010, 08:59 PM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, Yesterday, 06:40 PM
|
2 responses
20 views
0 likes
|
Last Post
by algospoke
Today, 07:04 PM
|
||
Started by ghoul, Today, 06:02 PM
|
3 responses
14 views
0 likes
|
Last Post Today, 06:43 PM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
45 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
7 responses
21 views
0 likes
|
Last Post Today, 06:16 PM | ||
Started by AttiM, 02-14-2024, 05:20 PM
|
10 responses
181 views
0 likes
|
Last Post
by jeronymite
Today, 06:11 PM
|
Comment