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
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
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.
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.Brandon H.NinjaTrader Customer Service
-
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.Brandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by geddyisodin, 04-25-2024, 05:20 AM
|
8 responses
60 views
0 likes
|
Last Post Yesterday, 10:45 AM | ||
Started by jxs_xrj, 01-12-2020, 09:49 AM
|
4 responses
3,285 views
1 like
|
Last Post
by jgualdronc
Today, 10:02 AM
|
||
Can someone turn this thinkscript into a ninjascript. 5PM CST OHL and Previous Day
by Option Whisperer
Started by Option Whisperer, Today, 09:55 AM
|
0 responses
5 views
0 likes
|
Last Post Today, 09:55 AM | ||
Started by halgo_boulder, 04-20-2024, 08:44 AM
|
2 responses
22 views
0 likes
|
Last Post Today, 09:41 AM | ||
Started by mishhh, 05-25-2010, 08:54 AM
|
19 responses
6,189 views
0 likes
|
Last Post
by rene69851
Today, 09:29 AM
|
Comment