Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Get indicator values from another chart
Collapse
X
-
Get indicator values from another chart
Hi, if i have 2 charts from same instrument for example one with candles of 5 minute an another with candles of 1 minutes, and i add a indicator to the 5 minute chart, it is possible if i add a strategy to the 1 minute chart to get values or variables from indicator in 5 minute chart?
Tags: None
-
Hello arbeydario,
Thanks for your post.
You would need to add an additional data series to your script using AddDataSeries() for the instrument/timeframe you want to get the indicator value from. If an instrument is not specified, the primary instrument will be used. For example, you could add a 5-minute data series to your script by calling AddDataSeries(BarsPeriodType.Minute, 5); in the State.Configure section of OnStateChange.
After adding an additional data series, you could pass Closes[1] as the Series<double> input argument for that secondary data series in when instantiating your indicator in State.DataLoaded. You could then print out that indicator value or use it in a condition or action.
See the sample code below.
See the help guide documentation below for more information and sample code.Code://class level variable private SMA SMA1; //OnStateChange else if (State == State.Configure) { AddDataSeries(Data.BarsPeriodType.Minute, 5); } else if (State == State.DataLoaded) { SMA1 = SMA(Closes[1], 14); } //OnBarUpdate protected override void OnBarUpdate() { Print("SMA1: " + SMA1[0]); }
AddDataSeries: https://ninjatrader.com/support/help...dataseries.htm
Closes: https://ninjatrader.com/support/help...nt8/closes.htm
SMA: https://ninjatrader.com/support/help...simple_sma.htm
Working with Multi-Timeframe/Multi-Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm
Let me know if I may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
47 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
33 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
50 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment