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 |

Plot no longer functions after update Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
hkusp40
Posted : Thursday, March 5, 2009 8:45:40 PM
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
StockGuy
Posted : Thursday, March 5, 2009 10:47:55 PM

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

hkusp40
Posted : Friday, March 6, 2009 4:46:18 AM
Registered User
Joined: 7/13/2008
Posts: 35
It worked great. I appreciate the support, SG.


hkusp40
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.