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
Indicator obtained from multiple graphs
Collapse
X
-
Hi Alberto, thanks for the follow up.
1. You can use EMA8 when CurrentBar is less than 21 and greater than 8, then continue to use a 21 ema after CurrentBar reaches 21.
2. BarsArray is a way of targeting the default price series of each series added to the script (Closes[0], Closes[1], etc). You can alternatively use Opens, Closes, Highs, Lows, etc.
3. Inputs can be an indicator data series input for the primary series, Closes is always going to be a price series.
Best regards,
-ChrisL
Leave a comment:
-
Thanks for the answer.
Code:namespace NinjaTrader.NinjaScript.Indicators { public class XXX : Indicator { private EMA emaEC_8; private EMA emaEC_21; private EMA emaAC_8; private EMA emaAC_21; protected override void OnStateChange() { if (State == State.SetDefaults) { ..... } else if (State == State.Configure) { AddDataSeries(BarsPeriodType.Minute, 10); } else if (State == State.DataLoaded) { emaEC_8 = EMA(BarsArray[0], 8); emaEC_21 = EMA(BarsArray[0], 21); emaAC_8 = EMA(BarsArray[1], 8); emaAC_21 = EMA(BarsArray[1], 21); } } protected override void OnBarUpdate() { if ( BarsInProgress!=0 ) return; // ensure both series have at least X bar if ( CurrentBars[0]<21 || CurrentBars[1]<21 ) return; emaEC_8C[0] = emaEC_8[0]; emaEC_21C[0] = emaEC_21[0]; emaAC_8C[0] = emaAC1_8[0]; emaAC_21C[0] = emaAC1_21[0]; if ( ( Closes[0][0]>emaEC_8[0] || Closes[0][0]>emaEC_21[0] ) && ( Closes[0][0]>emaAC_8[0] || Closes[0][0]>emaAC_21[0] ) ) { .... } } } }
1) I use:
Code:if ( CurrentBars[0]<21 || CurrentBars[1]<21 ) return;
2) I use:
Code:emaEC_8 = EMA(BarsArray[0], 8); emaEC_21 = EMA(BarsArray[0], 21); emaAC_8 = EMA(BarsArray[1], 8); emaAC_21 = EMA(BarsArray[1], 21);
Code:SMA1 = SMA(Close, 10);
3) Difference between Closes[0][0] (or Closes[1][0]) and Inputs[0][0] (or Inputs[1][0])???
Thanks Alberto
Leave a comment:
-
Hi Alberto, see here for an indicator example:
https://ninjatrader.com/support/foru...king-something
Best regards,
-ChrisLLast edited by NinjaTrader_ChrisL; 12-07-2021, 02:19 PM.
Leave a comment:
-
Thanks for the answer.
Is there an example applied to indicators and not to strategies?
Thanks Alberto
Leave a comment:
-
HI Alberto, thanks for posting.
There is support for multi instrument/timeframe scripts in the NinjaScript library. Use AddDataSeries() to add extra data series. The primary series will be the chart you run the indicator from. See here for a full guide on multi instrument/timeframe scripts. We also have a couple of strategy examples here:
Best regards,
-ChrisL
Leave a comment:
-
Indicator obtained from multiple graphs
Hi,
I have three different charts, I want to create an indicator to apply only to one of these charts.
The indicator must generate a print on the graph (or other) starting from the analysis of all three graphs and their indicators.
It's possible? A few examples?
Thanks AlbertoTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by adeelshahzad, Today, 11:49 AM
|
1 response
3 views
0 likes
|
Last Post Today, 11:56 AM | ||
Started by spottysallrite, Today, 11:31 AM
|
1 response
4 views
0 likes
|
Last Post Today, 11:43 AM | ||
Started by johnMoss, 03-04-2024, 01:53 PM
|
2 responses
31 views
0 likes
|
Last Post
by Overnhou
Today, 11:21 AM
|
||
Started by Padan, Today, 02:02 AM
|
5 responses
17 views
0 likes
|
Last Post Today, 11:14 AM | ||
Started by Lele2k24, Yesterday, 11:24 AM
|
8 responses
28 views
0 likes
|
Last Post
by Lele2k24
Today, 11:00 AM
|
Leave a comment: