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 |

Accumulation scan Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
giomorales
Posted : Sunday, January 4, 2009 11:06:38 PM
Registered User
Joined: 3/12/2007
Posts: 10
I need to write code for an accumulation scan with the following rules:

1.  Scan looks at volume over last ten-day period.

2.  Strategy requires that volume be at least 30% above the

21 day average on three up days during last ten days, and no

above average volume on any down days

Can you help me with this?

Thanks,
Gio
Bruce_L
Posted : Wednesday, January 7, 2009 2:27:10 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try the following RealCode Rule:

Static Up As Integer
Static Dn As Integer
Static AvgV21(9) As Single
If isFirstBar Then
    Up = 0
    Dn = 0
    For i As Integer = 0 To 9
        AvgV21(i) = 0
    Next
End If
If CurrentIndex >= 30 Then
    If Volume(10) >= 1.3 * AvgV21(CurrentIndex Mod 10) AndAlso _
        Price.Last(10) > Price.Last(11) Then Up -= 1
    If Volume(10) > AvgV21(CurrentIndex Mod 10) AndAlso _
        Price.Last(10) < Price.Last(11) Then Dn -= 1
End If
AvgV21(CurrentIndex Mod 10) = AvgV21((CurrentIndex + 9) Mod 10) + Volume / 21
If CurrentIndex >= 21 Then AvgV21(CurrentIndex Mod 10) = _
        AvgV21(CurrentIndex Mod 10) - Volume(21) / 21
If CurrentIndex >= 20 Then
    If Volume >= 1.3 * AvgV21(CurrentIndex Mod 10) AndAlso _
        Price.Last > Price.Last(1) Then Up += 1
    If Volume > AvgV21(CurrentIndex Mod 10) AndAlso _
        Price.Last < Price.Last(1) Then Dn += 1
End If
If CurrentIndex >= 29 Then
    If Up >= 3 AndAlso Dn = 0 Then Pass
Else
    SetIndexInvalid
End If 

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
giomorales
Posted : Tuesday, January 13, 2009 12:04:51 AM
Registered User
Joined: 3/12/2007
Posts: 10
Thanks Bruce. The scan works very well. Could you please tell me what parameters I need to change to now create a distribution scan with the same rules?

1.  Scan looks at volume over last ten-day period.

2.  Strategy requires that volume be at least 30% above the
21-day average on three down days during last ten days
 
3.  No above average volume on any up days

Gio
Bruce_L
Posted : Tuesday, January 13, 2009 9:49:36 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try the following RealCode Rule:

Static Up As Integer
Static Dn As Integer
Static AvgV21(9) As Single
If isFirstBar Then
    Up = 0
    Dn = 0
    For i As Integer = 0 To 9
        AvgV21(i) = 0
    Next
End If
If CurrentIndex >= 30 Then
    If Volume(10) > AvgV21(CurrentIndex Mod 10) AndAlso _
        Price.Last(10) > Price.Last(11) Then Up -= 1
    If Volume(10) >= 1.3 * AvgV21(CurrentIndex Mod 10) AndAlso _
        Price.Last(10) < Price.Last(11) Then Dn -= 1
End If
AvgV21(CurrentIndex Mod 10) = AvgV21((CurrentIndex + 9) Mod 10) + Volume / 21
If CurrentIndex >= 21 Then AvgV21(CurrentIndex Mod 10) = _
        AvgV21(CurrentIndex Mod 10) - Volume(21) / 21
If CurrentIndex >= 20 Then
    If Volume > AvgV21(CurrentIndex Mod 10) AndAlso _
        Price.Last > Price.Last(1) Then Up += 1
    If Volume >= 1.3 * AvgV21(CurrentIndex Mod 10) AndAlso _
        Price.Last < Price.Last(1) Then Dn += 1
End If
If CurrentIndex >= 29 Then
    If Dn >= 3 AndAlso Up = 0 Then Pass
Else
    SetIndexInvalid
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mike From Philly
Posted : Thursday, September 24, 2009 9:47:31 PM
Registered User
Joined: 9/18/2009
Posts: 60

I loaded this in SF and had a bunch of complier errors.  Is it possible to update this?

StockGuy
Posted : Thursday, September 24, 2009 10:23:15 PM

Administration

Joined: 9/30/2004
Posts: 9,187

You have to use Volume.value now in RealCode instead of just Volume.  Try this:

Static Up As Integer
Static Dn As Integer
Static AvgV21(9) As Single
If isFirstBar Then
 Up = 0
 Dn = 0
 For i As Integer = 0 To 9
  AvgV21(i) = 0
 Next
End If
If CurrentIndex >= 30 Then
 If Volume.value(10) > AvgV21(CurrentIndex Mod 10) AndAlso _
  Price.Last(10) > Price.Last(11) Then Up -= 1
 If Volume.value(10) >= 1.3 * AvgV21(CurrentIndex Mod 10) AndAlso _
  Price.Last(10) < Price.Last(11) Then Dn -= 1
End If
AvgV21(CurrentIndex Mod 10) = AvgV21((CurrentIndex + 9) Mod 10) + Volume.value / 21
If CurrentIndex >= 21 Then AvgV21(CurrentIndex Mod 10) = _
  AvgV21(CurrentIndex Mod 10) - Volume.value(21) / 21
If CurrentIndex >= 20 Then
 If Volume.value > AvgV21(CurrentIndex Mod 10) AndAlso _
  Price.Last > Price.Last(1) Then Up += 1
 If Volume.value >= 1.3 * AvgV21(CurrentIndex Mod 10) AndAlso _
  Price.Last < Price.Last(1) Then Dn += 1
End If
If CurrentIndex >= 29 Then
 If Dn >= 3 AndAlso Up = 0 Then Pass
 Else
  SetIndexInvalid
End If

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.