Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Help with visiblebar percent change code Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
robconley
Posted : Sunday, July 25, 2010 11:37:21 AM
Registered User
Joined: 3/10/2005
Posts: 28

I am in hopes someone can help me with some code.  I'm a bit of a hack coder, so please bear with me.  I'm simply trying to chart the cumulative percent change of visible bars - from left of screen to last bar.  While the code sort of works, it doesn't always display when the chart is opened, doesn't expand to a new zoom, and never displays when changing time frames away from a daily time frame.

I know at least part of my problem (if not all of it) is the use of TotalBars variable.  I've set it to 5000 because that's the setting for 'max daily bars to read' in the data manager utility for the entire program.  Obviously, I'm not reading that many bars on a weekly or monthly time frame.  But I couldn't figure out any other means to determine when to begin plotting.  Ideas?

Thanks  -Rob

'# RECALC_ON_ZOOM_SCROLL
'# Symbol = UserInput.String = "DXY0"
'# TotalBars = UserInput.Integer = 5000

Static altPrice As WBI.CommonBlocks.RealCodeIndicator
Static BeginningOfVisiblePriceBars As Integer = TotalBars - ActiveChart.BarsVisible
Static Offset As Integer = 0

If isFirstBar Then
 altPrice = PriceData(Symbol)
End If

If CurrentIndex > BeginningOfVisiblePriceBars Then
 Plot = ((altPrice.Value - altPrice.Value(Offset)) / altPrice.Value(Offset) * 100)
 Offset += 1
Else
 Plot = Single.Nan
End If

Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.