Say I'm running my strategy, in a 10 minute chart. I'd like to get the EMA(20) value from the 10 minute, 5 minute, and 1 minute charts. How to do? Thanks
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
Getting the EMA from two different time frames?
Collapse
X
-
Getting the EMA from two different time frames?
How to I get the EMA (or other indicator value) from two different time frames?
Say I'm running my strategy, in a 10 minute chart. I'd like to get the EMA(20) value from the 10 minute, 5 minute, and 1 minute charts. How to do? ThanksTags: None
-
Hello timmbbo,
Thank you for your note.
To calculate the values of an indicator for a time series which is not the primary series, you would have to add additional data series, for example,
Code:AddDataSeries(BarsPeriodType.Minute, 5); AddDataSeries(BarsPeriodType.Minute, 10);
Then you should add current bar checks to make sure each series has enough bars, for example,
Code:if(CurrentBars[0] <20 || CurrentBars[1]<20 || CurrentBars[2]<20) return;
Then you can set the value of the indicator to a plot or a variable or use in your conditions.
I have attached a sample strategy which adds 2 additional data series and sets plot values equal to the simple moving average of the primary, secondary, and third data series.
Please let us know if you need further assistance.Alan P.NinjaTrader Customer Service
-
Originally posted by timmbbo View PostHow to I get the EMA (or other indicator value) from two different time frames?
Say I'm running my strategy, in a 10 minute chart. I'd like to get the EMA(20) value from the 10 minute, 5 minute, and 1 minute charts. How to do? Thanks
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
147 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
||
Started by mattbsea, Today, 05:44 PM
|
0 responses
5 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
33 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
4 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,282 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
Comment