Registered User Joined: 4/19/2009 Posts: 18
|
i currently have an indicator set up to find % return from prior date to get quarterly return for example:
Dim Ref As Single
For i As Integer = 0 To 90
If price.datevalue(i).year = 2010 And price.datevalue(i).month = 4 And price.datevalue(i).day = 1 Then
Ref = price.Close(i)
End If
Next
plot = ((price.close - Ref) / Ref) * 100
my question is there a way to access a specific date in the code without looping to find it
Tim
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
Yes.
Try this:
static ref as single
if isFirstBar then
ref = price.ValueForDate("4/1/2010 4:00 PM")
end if
if ref > 0 then
plot = ((price.close - ref) / ref) * 100
end if
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
Registered User Joined: 4/19/2009 Posts: 18
|
perfect,
thanks Ken
Tim
|