-
Determining which bars are currently on screen
Hi guys,
I'm writing an indicator (NT 8 Beta) which labels the bars with their number, 1 being the first bar of the session.
I'm using Draw.Text and the indicator works fine - EXCEPT it appears to be consuming too much in the way of resources. Moving the mouse/cursor over a chart becomes very laggy as does performing any manual operation such as scrolling through the chart, using a drawing tool. This is because around 9,000 drawing objects are created (the number of bars in the chart).
Is there a way of determining which bars are visible on screen so that I could create those drawing objects only on the fly, significantly reducing the number of drawing objects existing at any one time and thus, hopefully, improving performance?
-
Thanks for your post.
One of the improvement over NT7 that we added in NT8 was the ability to see the bars ago and the current bar numbers.
Please open a "databox" window (Left click on the charts toolbar 6th icon from the left to open the data box). In the databox, right mouse click then select "show bar indexes" and/or "show bars ago". These will add two rows in the databox showing bar index 999 of 9999 and bars ago of 99.
-
I already played with those features but unfortunately I need the count to reset at the start of the trading session. So the first bar of the day's trading session is always #1 etc.
However, you've given me an idea. Instead of using Draw.Text, why don't I create an indicator which holds the index number of the current session as its value but doesn't plot anything. Then, I should be able to read the value of the indicator in the Data Box. This should be much more efficient in terms of resources.
Going to try it now.
-
I have the following simple code, but for some reason I can't get it to display even the indicator name in the Data Box. Oddly, if I remove the assignment to Value[0], the indicator's name now appears in the Data Box but obviously no values. Any ideas? Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules