Where is this described, and are there others I should know about or be able to find as parts of Ninja Language capabilities.
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
IsLastBarOnChart() and others ?
Collapse
X
-
IsLastBarOnChart() and others ?
I am relatively new to Ninja and I spend a lot of time in the manual / doc. I am familiar with EasyLanguage and to a lesser extent C# with it's methods/ properties/ classes, etc. So, my point is, I am familiar in searching for things. I was not able to find IsLastBarOnChart description using both the alphabetical listing as well as the search. Search did find it being used in an example.
Where is this described, and are there others I should know about or be able to find as parts of Ninja Language capabilities.Tags: None
-
Hello joromero,
Thank you for the question.
In regards to the IsLastBarOnChart, you would not see this as it is undocumented as it is not supported but it is usable.
Alternatively you can access the current bar information by doing the following.
If you are trying to make the script wait until it is at the last bar of the chat and then start calculating you could use the statement below:
Code:if(CurrentBar < Count - 1) return;
Here is the documentation on Count
Another check is the historical check, this allows you to only execute after a new tick is received.
So if you have this enabled on an indicator or strategy and apply it to a chart, it will do nothing past this line of code until a new tick is received.
Code:if(Historical) return;
Please let me know if I may be of additional assistance.Last edited by NinjaTrader_Jesse; 07-07-2014, 08:06 AM.JesseNinjaTrader Customer Service
-
hello Jesse,
How to draw text on last bar only after chart is completley load.
For example if I use F5 to refresh chart with strategy , text is drawing on each bar
(Chart period is 1 second)
So I would like strart drawing text in real time only.
if (CurrentBar > (Bars.Count - 2))
Draw.Text(this, CurrentBar.ToString() + ( Close[0]).ToString() , "X", 0, Close[0]+0.05, Brushes.Black);
(doesn't work)
thank you
Comment
-
Hello oceanis400,
If you want to only draw one object, the most simple way is to use a non-unique tag:
Code:Draw.Text(this,[B] "MyNonUniqueTag"[/B] , "X", 0, Close[0]+0.05, Brushes.Black);
Please let me know if I may be of further assistance.JesseNinjaTrader Customer Service
Comment
-
Hello Jesse,
No , I want to draw or plot only when last bar is load and display on chart.
I haven't find way to do it.
Text is drawing on all chart on every bar loaded. But I want to start drawing text in realtime only. (on each bar period 1s)
sincerely
Comment
-
-
-
Hello oceanis400,
Thank you for the post.
In this case, it looks as I had responded with NT7 syntax as we are in the NT7 forums. For NT8 questions please ensure to post in the NT8 forums going forward. I will move this to the NT8 forums.
For converting syntax from NT7 to NT8 you can use the code-breaking changes guide to find differences (select all from the dropdown and control + F Historical): https://ninjatrader.com/support/help...ng_changes.htm
For Historical, this is replaced with the State object and State system.
Code:if(State == State.Realtime) { }
JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by adeelshahzad, Today, 03:54 AM
|
5 responses
31 views
0 likes
|
Last Post Today, 11:29 AM | ||
Started by stafe, 04-15-2024, 08:34 PM
|
7 responses
31 views
0 likes
|
Last Post Today, 11:19 AM | ||
Started by merzo, 06-25-2023, 02:19 AM
|
10 responses
823 views
1 like
|
Last Post Today, 10:38 AM | ||
Started by frankthearm, Today, 09:08 AM
|
5 responses
18 views
0 likes
|
Last Post Today, 10:19 AM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
43 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
Comment