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
How to plot last price on the charts
Collapse
X
-
Hello,
Thank you for the question.
If you are looking to plot just the last price you could create an indicator and use it on CalculateOnBarClose = false and reference the Close[0] as the Last price.
The Close would be considered the Close of the bar if you have CalculateOnbarClose = true or the Last price if you have CalculateOnbarClose = false.
You can also use something like a 1 period SMA set on CalculateOnbarClose = false if you do not want to manually code this. You can define the input series if you would like a different set of values other than the Close of each bar.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Originally posted by NinjaTrader_Jesse View PostHello,
Thank you for the question.
If you are looking to plot just the last price you could create an indicator and use it on CalculateOnBarClose = false and reference the Close[0] as the Last price.
The Close would be considered the Close of the bar if you have CalculateOnbarClose = true or the Last price if you have CalculateOnbarClose = false.
You can also use something like a 1 period SMA set on CalculateOnbarClose = false if you do not want to manually code this. You can define the input series if you would like a different set of values other than the Close of each bar.
I look forward to being of further assistance.
Comment
-
Hello,
Thank you for the clairification.
You would need to pass through the Close[0] information to this box as well as putting the indicator into CalculateOnBarClose = false.
If the case is that you can not use COBC = false you could look into using the OnMarketData method to update your box as ticks are coming in.
There is also an example that includes the Last price in the following link:
Please let me know if I may be of additional assistance.JesseNinjaTrader Customer Service
Comment
-
Hello,
In NinjaScript or C# you can turn most things into strings by adding ToString() to the end of it or if you are combining a number with a string you dont even need to go that far.
Here are a couple examples:
Code:MessageBox.Show(DateTime.Now.ToString() + "\n\n Sell Signal generated for " + Instrument.FullName + ".", Instrument.FullName + " SELL ALERT! + " Price at: " + Close[0]);
Code:string price = Close[0].ToString();
JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by LiamTwine, Today, 08:10 AM
|
0 responses
2 views
0 likes
|
Last Post
by LiamTwine
Today, 08:10 AM
|
||
Started by Balage0922, Today, 07:38 AM
|
0 responses
5 views
0 likes
|
Last Post
by Balage0922
Today, 07:38 AM
|
||
Started by JoMoon2024, Today, 06:56 AM
|
0 responses
6 views
0 likes
|
Last Post
by JoMoon2024
Today, 06:56 AM
|
||
Started by Haiasi, 04-25-2024, 06:53 PM
|
2 responses
19 views
0 likes
|
Last Post
by Massinisa
Today, 05:32 AM
|
||
Started by Creamers, Today, 05:32 AM
|
0 responses
6 views
0 likes
|
Last Post
by Creamers
Today, 05:32 AM
|
Comment