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 |

CCI Double Bottom Strategy Help Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Designer
Posted : Wednesday, December 8, 2010 12:19:11 PM
Registered User
Joined: 9/30/2006
Posts: 317
I would like to have a code for entering positions in stocks when the CCI forms a double bottom :
1- Enter Long when CCI crosses up thru -100 and 
2- CCI  has crossed up -100 X number of bars ago (I would like to have the option to modify number of bars ago and the bars range) and 
3- CCI was (timewise) after condition 2 and before condition 1 above -100 and below 0.

The strategy is both for daily and intra day minutes timeframes.

Thanks in advance.
Bruce_L
Posted : Wednesday, December 8, 2010 12:24:13 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
QUOTE (Designer)
CCI  has crossed up -100 X number of bars ago (I would like to have the option to modify number of bars ago and the bars range)...

Exactly X Bars Ago, less than X Bars Ago or more than X Bars Ago?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Designer
Posted : Wednesday, December 8, 2010 1:42:34 PM
Registered User
Joined: 9/30/2006
Posts: 317
Bruce,   X to be a range rather than an exact number ... asume 10 to 20 bars but I would like to be able to modify this number.
Thanks
Bruce_L
Posted : Wednesday, December 8, 2010 2:00:18 PM


Worden Trainer

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

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:CCI Double Bottom
'|******************************************************************
'# CCI = indicator.Library.Commodity Channel Index CCI
'# BarsAgoStart = UserInput.Integer = 10
'# BarsAgoEnd = UserInput.Integer = 20
'# Cumulative
Static Since As Single
Static Range(1) As Integer
If isFirstBar OrElse CCI.Value >= 0 Then
    Since = Single.NaN
    Range(0) = System.Math.Min(BarsAgoStart, BarsAgoEnd)
    Range(1) = System.Math.Max(BarsAgoStart, BarsAgoEnd)
End If
Since += 1
If CCI.Value > -100 AndAlso CCI.Value(1) <= -100 Then
    If Range(0) <= Since AndAlso Since <= Range(1) Then
        Pass
    End If
    Since = 0
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Designer
Posted : Tuesday, December 21, 2010 12:01:25 PM
Registered User
Joined: 9/30/2006
Posts: 317
Bruce, Thanks very much ...it works very well.
One quick question... could you ad an alert to the code so it can give a signal in my watchlist when the condition is met...
Thanks
Bruce_L
Posted : Tuesday, December 21, 2010 12:09:09 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
If you just want it to show something in your WatchList, you can just Drag and Drop the Condition to your WatchList to use it as a Condition Column or Sort.

Scanning with Conditions

StockFinder does not have Realtime Alerts built in. The RealCode Programmers Reference has a section on Simulating an Alert with RealCode Rules which covers one method of creating alerts in StockFinder.

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