Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 7/13/2008 Posts: 35
|
When I loaded SF4 today it updated to a new build and subsequently one of my plots, MIDAS, no longer appears. I noticed some RealCode changes in the volume functions and suspect that this is the cause. Here is the MIDAS code I'm using:
'***************************************
'* Example: Returns the net change *
'* Plot = Price.Close - Price.Close(1) *
'***************************************
'# Year = UserInput.Integer = 2008
'# Month = UserInput.Integer = 1
'# Day = UserInput.Integer = 1
'# Leave the Hour, Minute, Second values set to 0 for MIDAS.
'# Hour = UserInput.Integer = 0
'# Minute = UserInput.Integer = 0
'# Second = UserInput.integer = 0
Static StartDate As Date
Static CumPrice As Double
Static CumVolume.value As Double
If isFirstBar Then
StartDate = New Date(Year, Month, Day, Hour, Minute, Second)
CumPrice = 0
CumVolume.value = 0
End If
If CurrentDate >= StartDate Then
CumPrice += Price.Last * Volume.value
CumVolume.value += Volume.value
Plot = CumPrice / CumVolume.value
Else
Plot = Single.NaN
End If
'# Cumulative
How can I go about correcting this? Thanks.
hkusp40
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
I think the upgrade added .value after "volume" in the RealCode which messed up the CumVolume parts of your code.
Remove the .value where I bolded it below. Plotted fine for me after I did that.
'***************************************
'* Example: Returns the net change *
'* Plot = Price.Close - Price.Close(1) *
'***************************************
'# Year = UserInput.Integer = 2008
'# Month = UserInput.Integer = 1
'# Day = UserInput.Integer = 1
'# Leave the Hour, Minute, Second values set to 0 for MIDAS.
'# Hour = UserInput.Integer = 0
'# Minute = UserInput.Integer = 0
'# Second = UserInput.integer = 0
Static StartDate As Date
Static CumPrice As Double
Static CumVolume.value As Double
If isFirstBar Then
StartDate = New Date(Year, Month, Day, Hour, Minute, Second)
CumPrice = 0
CumVolume.value = 0
End If
If CurrentDate >= StartDate Then
CumPrice += Price.Last * Volume.value
CumVolume.value += Volume.value
Plot = CumPrice / CumVolume.value
Else
Plot = Single.NaN
End If
'# Cumulative
|
|
Registered User Joined: 7/13/2008 Posts: 35
|
It worked great. I appreciate the support, SG.
hkusp40
|
|
Guest-1 |