NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 11-03-2011, 12:45 AM   #1
yaris
Junior Member
 
Join Date: Jul 2011
Posts: 5
Thanks: 2
Thanked 0 times in 0 posts
Default The last displayed bar on the chart screen

Hi,
for my discretionary strategy backtesting I have to quickly see some information about last displayed bar on the screen. When I'm browsing in history I always want to see these informations about last bar. I don't know where to get the reference to this bar.

Thanks
yaris is offline  
Reply With Quote
Old 11-03-2011, 02:15 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
Default

Welcome to our forums yaris - unfortunately accessing this info via a NinjaScript study would not be supported.
NinjaTrader_Bertrand is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Bertrand for this post:
Old 11-03-2011, 11:38 AM   #3
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,218
Thanks: 24
Thanked 1,231 times in 1,002 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by yaris View Post
Hi,
for my discretionary strategy backtesting I have to quickly see some information about last displayed bar on the screen. When I'm browsing in history I always want to see these informations about last bar. I don't know where to get the reference to this bar.

Thanks
Not sure that I understand what you are seeking. You need to see this information. Where and how are you seeking to display that information? Getting the last bar displayed on the chart and using it as an offset from CurrentBar should give you access to the bar's properties.
Last edited by koganam; 11-03-2011 at 03:31 PM. Reason: Corrected punctuation
koganam is offline  
Reply With Quote
Old 11-03-2011, 02:17 PM   #4
yaris
Junior Member
 
Join Date: Jul 2011
Posts: 5
Thanks: 2
Thanked 0 times in 0 posts
Default

Thanks for reply. But how can I get the last bar displayed from indicator code? I'm looking in this.ChartControl properties, but I don't see anything usable.
yaris is offline  
Reply With Quote
Old 11-03-2011, 03:00 PM   #5
yaris
Junior Member
 
Join Date: Jul 2011
Posts: 5
Thanks: 2
Thanked 0 times in 0 posts
Default

What I want to do, is the same as the small floating data window accessible by middle mouse button in chart, but always visible in top left corner of chart window and referenced to the right most displayed bar. Not to a position of cursor.
yaris is offline  
Reply With Quote
Old 11-03-2011, 03:29 PM   #6
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hi Yaris,

It seems like a good idea. Unfortunately there are not supported NinjaScript properties for identifying the right-most displayed bar.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 11-03-2011, 03:30 PM   #7
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,218
Thanks: 24
Thanked 1,231 times in 1,002 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by yaris View Post
What I want to do, is the same as the small floating data window accessible by middle mouse button in chart, but always visible in top left corner of chart window and referenced to the right most displayed bar. Not to a position of cursor.
I am going to assume then that all you want is how to get the index of the last bar showing on the screen, and that you know how to query and display the information on the screen with DrawTextFixed()? If that is correct, then there are 2 ways to get the last bar painted, both undocumented and unsupported by NT Support, so do not even ask.
  1. int intLastBarOnChart = ChartControl.LastBarPainted;
  2. int intLastBarPaintedOnChart = this.LastBarIndexPainted;
The first index is dependent on the COBC property; the second one is absolute.
koganam is offline  
Reply With Quote
The following 2 users say thank you to koganam for this post:
Old 11-03-2011, 03:54 PM   #8
VTtrader
Senior Member
 
Join Date: Feb 2008
Location: www.integratedtradingtech.com
Posts: 270
Thanks: 1
Thanked 79 times in 64 posts
Default

Quote:
Originally Posted by yaris View Post
What I want to do, is the same as the small floating data window accessible by middle mouse button in chart, but always visible in top left corner of chart window and referenced to the right most displayed bar. Not to a position of cursor.
Yaris,

We have a new customizable DataBox that can be configured to do exactly what you're looking for. You can check it out and find out more information on our website to see if it meets your needs.

Integrated Trading Technologies

VT
VTtrader is offline  
Reply With Quote
Old 11-03-2011, 04:15 PM   #9
RaptorUK
Junior Member
 
Join Date: Nov 2011
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
Question

Quote:
Originally Posted by NinjaTrader_RyanM View Post
Hi Yaris,

It seems like a good idea. Unfortunately there are not supported NinjaScript properties for identifying the right-most displayed bar.
Pardon my ignorance . . but isn't that bar 0 ?
RaptorUK is offline  
Reply With Quote
Old 11-03-2011, 04:21 PM   #10
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,218
Thanks: 24
Thanked 1,231 times in 1,002 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by RaptorUK View Post
Pardon my ignorance . . but isn't that bar 0 ?
The rightmost displayed bar, not the rightmost bar, which would be bar0.
koganam is offline  
Reply With Quote
Old 11-03-2011, 04:44 PM   #11
yaris
Junior Member
 
Join Date: Jul 2011
Posts: 5
Thanks: 2
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by koganam View Post
I am going to assume then that all you want is how to get the index of the last bar showing on the screen, and that you know how to query and display the information on the screen with DrawTextFixed()? If that is correct, then there are 2 ways to get the last bar painted, both undocumented and unsupported by NT Support, so do not even ask.
  1. int intLastBarOnChart = ChartControl.LastBarPainted;
  2. int intLastBarPaintedOnChart = this.LastBarIndexPainted;
The first index is dependent on the COBC property; the second one is absolute.
The frist index looks good but works little unpredictable. There is a shift of 1, but not always. I have to do more tests.


Thanks. I'm going to write some code, not post.

DrawTextFixed(
"Bottom", High[this.Bars.Count - this.LastBarIndexPainted].ToString() + "\n" + Low[this.Bars.Count - this.LastBarIndexPainted].ToString() , TextPosition.TopLeft, Color.Black, textFont, Color.Transparent, Color.Transparent, 10 );
yaris is offline  
Reply With Quote
Old 11-03-2011, 04:53 PM   #12
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,218
Thanks: 24
Thanked 1,231 times in 1,002 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by yaris View Post
The frist index looks good but works little unpredictable. There is a shift of 1, but not always. I have to do more tests.


Thanks. I'm going to write some code, not post.

DrawTextFixed(
"Bottom", High[this.Bars.Count - this.LastBarIndexPainted].ToString() + "\n" + Low[this.Bars.Count - this.LastBarIndexPainted].ToString() , TextPosition.TopLeft, Color.Black, textFont, Color.Transparent, Color.Transparent, 10 );
As I said, the first index method depends on the COBC setting. It is consistent, not unpredictable. Your unpredictability is coming from using Bars.Count. Use CurrentBar instead.
koganam is offline  
Reply With Quote
The following user says thank you to koganam for this post:
Old 11-04-2011, 02:55 AM   #13
yaris
Junior Member
 
Join Date: Jul 2011
Posts: 5
Thanks: 2
Thanked 0 times in 0 posts
Default

Here is my solution and notes.
To show the databox after adding indicator I have to scroll chart. Sometimes textbox is not Invalidated (shows data for another bar), so I have to click anywhere in chart area.
But it is good enough for me.
COBC have to be TRUE.
Unpredictability of LastBarIndexPainted is comming from textbox Invalidation.
Attached Images
File Type: png BacktestDataBox.png (3.4 KB, 36 views)
Attached Files
File Type: cs BacktestBarData.cs (5.9 KB, 27 views)
Last edited by yaris; 11-04-2011 at 07:28 AM.
yaris is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading most current bar visually displayed shazzmoe Indicator Development 4 05-17-2011 02:34 PM
Update on Last Bar On Screen? pacpac Indicator Development 1 03-16-2011 05:17 AM
displayed data on screen Turtle Trader Version 7 Beta General Questions & Bug Reports 3 04-20-2010 09:02 AM
Suggestion regarding tool bar at top of screen toddaclark Version 7 Beta General Questions & Bug Reports 5 12-04-2009 08:15 AM
5 min Bar Color Displayed in Market Analyzer mrlucky1x Indicator Development 1 01-26-2009 12:54 PM


All times are GMT -6. The time now is 10:48 PM.