Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

How to write realcode for acc-dist? Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
xuy98
Posted : Monday, January 4, 2010 12:50:29 AM
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
Bruce_L
Posted : Monday, January 4, 2010 12:08:12 PM


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
xuy98
Posted : Monday, January 4, 2010 5:16:33 PM
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.
Bruce_L
Posted : Monday, January 4, 2010 5:52:43 PM


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