How could I know the value of any indicator if the price of the current bar closed, for example, with a value of 20 ticks higher? Example: what would be the value of ema(close, 14) if the price of the current candle was 20 ticks higher? Is there a way to program it in ninjascript?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Future value indicator
Collapse
X
-
Future value indicator
Hello,
How could I know the value of any indicator if the price of the current bar closed, for example, with a value of 20 ticks higher? Example: what would be the value of ema(close, 14) if the price of the current candle was 20 ticks higher? Is there a way to program it in ninjascript?Tags: None
-
Hello gviand,
Thanks for your post.
You could consider creating a Series<double> variable named something like myDouble and assign the Close[0] price plus 20 Ticks to this variable.
Then, you could pass this variable in for the Series<double> input argument when calling the EMA() method and assign this value to a plot.
See the attached reference sample demonstrating this.Code://class level variable private Series<double> myDouble; //OnStateChange if (State == State.SetDefaults) { AddPlot(Brushes.DodgerBlue, "Plot1"); } else if (State == State.DataLoaded) { myDouble = new Series<double>(this); } //OnBarUpdate protected override void OnBarUpdate() { myDouble[0] = Close[0] + 20 * TickSize; Values[0][0] = EMA(myDouble, 14)[0]; }
And, see the help guide documentation below for more information.
Series<T>: https://ninjatrader.com/support/help...t8/seriest.htm
EMA: https://ninjatrader.com/support/help...onential_e.htm
AddPlot(): https://ninjatrader.com/support/help...t8/addplot.htm
Let me know if I may assist further.Attached FilesLast edited by NinjaTrader_BrandonH; 08-09-2022, 01:31 PM.<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>
-
Thanks for your reply. What I need is something different. I need to calculate what would be the value of EMA(Close, 14) considering only that the current candle was 20 ticks higher, leaving the previous candles with their original close. That is, I need to simulate the value of candle number 0.
Comment
-
Hello gviand,
Thanks for your note.
This would go beyond what we would be able to provide support for. It would require you to program your own custom calculations within the script to determine what the EMA value might be if only the currently forming bar is 20 ticks higher. A Series<double> input must be used when calling EMA() as seen in post #2. It would not be possible to change a single candle's value for the EMA indicator to calculate.
This forum thread will be open for other community members to share their insights on possible custom calculations to accomplish this.
Let me know if I may assist further.Last edited by NinjaTrader_BrandonH; 08-09-2022, 03:02 PM.<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>
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
646 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
367 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
569 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment