Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Gold Customer
Joined: 7/21/2007 Posts: 32
|
What object do I have to declare to gain access to BarsVisible? I thought it would be Price History but not so.
|
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
Bars Visible? As in how many bars you can see on the chart?
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Gold Customer
Joined: 7/21/2007 Posts: 32
|
Yes, it is a Property of the ChartExecutionContext Class.
|
|
Gold Customer
Joined: 7/21/2007 Posts: 32
|
I need to compute the average volume over the visible bars as the first step to computing a volume adjusted moving average. I thought BarsVisible would help me do that but then I discovered that IsFirstBar CurrentDate was in June of 2002 with less than 5 months visible.
How would you write that code?
|
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:BarsVisible
'|******************************************************************
plot = activechart.barsvisible
However resizing the chart area does not refresh the value plotted until the symbol is changed.
|
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
QUOTE (jas0501)
However resizing the chart area does not refresh the value plotted until the symbol is changed.
Adding this to code will refresh your plot when you change the number of bars visible or scroll the chart.
'#RECALC_ON_ZOOM_SCROLL
See page 46 of the RealCode Reference.
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
QUOTE (Kuf) QUOTE (jas0501)
However resizing the chart area does not refresh the value plotted until the symbol is changed.
Adding this to code will refresh your plot when you change the number of bars visible or scroll the chart.
'#RECALC_ON_ZOOM_SCROLL
See page 46 of the RealCode Reference.
Cool!
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:BarsVisible
'|******************************************************************
'#RECALC_ON_ZOOM_SCROLL
plot = activechart.barsvisible
Note this permits displaying the number of bars visible on the toolbar by adding a data display item and editing the block diagram of said data display item.
Add Data Display.3
Edit Data Display.3's block diagram
Pin Bars Visible Demo pane and below shows bars visible resized to 850 with legend display:
|
|
Guest-1 |