Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 11/10/2007 Posts: 39
|
I have difficulty to write a cumulative indicator such as acc-dist.SF failed to compile the following codePlot = AccD.Value(1) + Volume.ValueActually it aalways crashes
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Do you have a particular formula or algorithm in mind for acc-dist (there are several Indicator of this name of which I'm aware)?
The following RealCode Indicator is just designed to demonstrate the creation of a Cumulative Indicator and is not designed to reflect any particular definition of acc-dist (it's actually OBV):
'# Cumulative
Static Sum As Single
If isFirstBar Then
Sum = 0
Else If Price.Last > Price.Last(1) Then
Sum += Volume.Value
Else If Price.Last < Price.Last(1) Then
Sum -= Volume.Value
End If
Plot = Sum
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 11/10/2007 Posts: 39
|
Thanks for the replay. Actually I am writing accumulation/distribution. I didn't know the condition of isFristBar. Now it's working.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome. I'm happy to read you were able to figure it out based on what I provided.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |