Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
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))
|
|
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
|
|
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.
|
|
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).
|
|
Registered User Joined: 9/10/2009 Posts: 11
|
Perfect. Thanks.
|
|
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:
|
|
Guest-1 |