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

Modified CCI Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
ADX trader
Posted : Monday, April 12, 2010 7:35:01 PM
Registered User
Joined: 9/10/2009
Posts: 11
I am a convert from TradeStation who is unfamiliar with Real Code and trying to get my feet wet.  I am looking to create an indicator that takes a 6 day sum of the Commodity Channel Index (3) and then subtracts 2 * ADX(14) if positive or adds 2 * ADX(14) if negative.

My TS code was as follows:
CWsum=iff(summation(CCI(3),6)>0,summation(CCI(3),6)-2*adx(14),summation(CCI(3),6)+2*adx(14))
jas0501
Posted : Monday, April 12, 2010 8:28:01 PM
Registered User
Joined: 12/31/2005
Posts: 2,499

One approach
1. add CCI indicator with period 3
2. add MA child indicator period 6
3. add ADX indicator period 14


'# ADX = chart.ADXLine.2
'# cciMA = chart.MovingAverage

If cciMA.value > 0 Then
 plot = cciMA.value * 6 - ADX.value * 2
Else
 plot = cciMA.value * 6 + ADX.value * 2
End If

ADX trader
Posted : Tuesday, April 13, 2010 12:00:52 PM
Registered User
Joined: 9/10/2009
Posts: 11
Thanks.  However, can I create this indicator (we'll call it CCIMod) and place it on the chart without having to place the CCI, its MA and the ADX on the chart? 

Rather than take the variable lengths of 3 and 14 from the chart for the CCI and ADX I would prefer to hard code them into the formula.

I want to be capable of using rules related to CCIMod as it relates to other indicators.
StockGuy
Posted : Tuesday, April 13, 2010 12:11:20 PM

Administration

Joined: 9/30/2004
Posts: 9,187
Try the attached indicator.  You can edit the the periods of the CCI and ADX plots inside the indicator editor.

Attachments:
CCI Mod.sfIndRC - 10 KB, downloaded 581 time(s).

ADX trader
Posted : Tuesday, April 13, 2010 1:15:22 PM
Registered User
Joined: 9/10/2009
Posts: 11
Perfect.  Thanks.
jas0501
Posted : Tuesday, April 13, 2010 4:13:11 PM
Registered User
Joined: 12/31/2005
Posts: 2,499
However, can I create this indicator (we'll call it CCIMod) and place it on the chart without having to place the CCI, its MA and the ADX on the chart? 

Yes saving the indiicator in V5 eliminates the need for ADX and CCI and the MA of CCI to be on the chart:
QUOTE (jas0501)

One approach
1. add CCI indicator with period 3
2. add MA child indicator period 6
3. add ADX indicator period 14


'# ADX = chart.ADXLine.2
'# cciMA = chart.MovingAverage

If cciMA.value > 0 Then
 plot = cciMA.value * 6 - ADX.value * 2
Else
 plot = cciMA.value * 6 + ADX.value * 2
End If



In V5 saving the realcode indicator unlinks ADX and CCI and makes the periods as parameters to the saved indicator:
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.