DrawText("7",true,"T", 2 ,High[2],0,Color.Blue,new Font("Arial", 8),StringAlignment.Center,Color.Black,Color.Yellow,10 );
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 refer to a specefic bar
Collapse
X
-
How to refer to a specefic bar
I am trying to DrawText on a specific bar but how do I refer to that bar, I have tried many things but with no success
Code:Tags: None
-
Hello,
This line of code is correct however you will need to add an additional check to ensure enough bars have been loaded before hand. If you go to tools -> output window you would see an error message
This can be avoided with a current bar check at the start of your OnBarUpdate()
example
if(CurrentBar < 2)
return;
Let me know if I can further assist.LanceNinjaTrader Customer Service
-
Thank you for the very fast reply,
when I enter the if statement it worked fine for 2 bars ago, and then I modified it to
Code:if (CurrentBar < 200) return;
Comment
-
You are correct in noticing Count will be the total number of bars on the chart.
However when an indicator is run it starts processing on bar 0 and will evaluate from left to right. The error is then being generated because it's trying to place a drawing object where there is no data at the very start
CurrentBar allows you to see the current bar that's being processed where as Count give total bars on the chart
Let me know if I can further assist.LanceNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Decrease the size of the RegionHIghLightY on each tick when the price touches it
by cmtjoancolmenero
Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
|
5 responses
25 views
0 likes
|
Last Post Today, 11:15 AM | ||
Started by Torontobluejays, Yesterday, 08:43 AM
|
3 responses
18 views
0 likes
|
Last Post Today, 11:15 AM | ||
Started by akuntysh, 05-18-2018, 03:39 AM
|
10 responses
809 views
0 likes
|
Last Post
by cedavra
Today, 11:14 AM
|
||
Started by Belfortbucks, 04-29-2024, 05:32 PM
|
1 response
15 views
0 likes
|
Last Post Today, 11:09 AM | ||
Started by Creamers, 04-27-2024, 05:32 AM
|
5 responses
37 views
0 likes
|
Last Post
by Creamers
Today, 11:34 AM
|
Comment