So I am building my custom indicator code and wondering why it is not plotting. I start experimenting with some basic series when I notice the following: A 2 bar EMA on a chart does not begin to plot until bar 20. This is on CL 5 min futures bar chart. Can anyone please illuminate me why it takes 20 bars before a 2 bar EMA starts to plot? Thank you.
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
Min Bars Required to Plot a Series
Collapse
X
-
Min Bars Required to Plot a Series
Hi,
So I am building my custom indicator code and wondering why it is not plotting. I start experimenting with some basic series when I notice the following: A 2 bar EMA on a chart does not begin to plot until bar 20. This is on CL 5 min futures bar chart. Can anyone please illuminate me why it takes 20 bars before a 2 bar EMA starts to plot? Thank you.Tags: None
-
Hello,
Thanks for the note.
This has to do with the bars required setting.which is defaulted to 20 in NinjaTrader. As you will get an error if you try to reference a bar back that you dont have data for.
and also, http://www.ninjatrader.com/support/f...ead.php?t=3229
Let me know if I can be of further assistance.
-
Originally posted by Zeos6 View PostI figured out the BarsRequired. It is set in the Initialize(). Thanks Brett. However, how do I set it for your precoded series like EMA? I don't want to create my own EMA code.
Comment
-
Hi Zeos,
You can save a copy of the system EMA if you want to set a different BarsRequired value. Right click in editor > Save As.
You can also use CurrentBar to only allows calculations after a certain number of bars have passed.
if (CurrentBar > 50) //do your EMA calcs here.Ryan M.NinjaTrader Customer Service
Comment
-
Thanks Ryan. It seems a lot of needless effort to duplicate a system EMA just to have it plot earlier than the 20 bar default. I get the calculated values earlier. This was just a cosmetic thing for me. I simply wanted to know if there was a way to reset the default BarsRequired value for system moving avrages, and the answer is no - you have to create your own veersion. Thanks for letting me know.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
26 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:43 PM
|
||
Started by wzgy0920, 02-22-2024, 01:11 AM
|
5 responses
32 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:33 PM
|
||
Started by wzgy0920, 04-23-2024, 09:53 PM
|
2 responses
49 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:29 PM
|
||
Started by Kensonprib, 04-28-2021, 10:11 AM
|
5 responses
193 views
0 likes
|
Last Post
by Hasadafa
Yesterday, 10:19 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
11 responses
3,235 views
0 likes
|
Last Post Yesterday, 08:07 PM |
Comment