Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 4/25/2007 Posts: 91
|
Please help me with this conversion of this PCF to Realcode:
(C - C5) / (ABS(C - C1) + ABS(C1 - C2) + ABS(C2 - C3) + ABS(C3 - C4) + ABS(C4 - C5) +.001).
Thanks, Jay
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
(price.close - price.Close(5)) / (system.Math.Abs(price.close - price.close(1)) _
+ system.Math.Abs(price.close(1) - price.Close(2)) + system.math.abs(price.close(2) - price.Close(3)) _
+ system.math.abs(price.close(3) - price.Close(4)) + system.math.abs(price.close(4) - price.close(5)) +.001)
|
|
Registered User Joined: 4/25/2007 Posts: 91
|
StockGuy, Thanks, Jay
|
|
Registered User Joined: 4/25/2007 Posts: 91
|
Stockguy, one more request on this item.
I added Dim Ratio as Single and did a Plot = Ratio, that works fine.
How about changing code to plot this ratio with a user defined variable instead of 5? so I can have 2 settings at 30 bars and 60 bars. I cut & pasted this 45 more times, but it should be possible to do it with a For loop, may be? May be Bruce could help?-- Jay
|
|
Registered User Joined: 4/25/2007 Posts: 91
|
Stockguy, Apologies, If I have misstated my response. I know that you could very well help me in the For loop, but I have seen several posts on these 'For loop' from Bruce and Craig, and I thought they may have already a solution.. Thanks again for your help.. Jay
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
My reply was the RealCode for the PCF you posted. Please state exactly what you're looking for if it's different from your original request.
|
|
Registered User Joined: 4/25/2007 Posts: 91
|
1)Plot the value (C - C30) / (ABS(C - C1) + ABS(C1 - C2) + ABS(C2 - C3) +..... ABS(C38 - C39) + ABS(C29 - C30) +.001)
2)Plot the value (C - C60) / (ABS(C - C1) + ABS(C1 - C2) + ABS(C2 - C3) +..... ABS(C58 - C59) + ABS(C59 - C60) +.001). Preferebly these 2 indicators are in the same pane. -I hope this clarifies. -- Jay
|
|
Registered User Joined: 3/23/2005 Posts: 3
|
A PCF formula for ADX Prod 27 and AVG 3 ??
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
jayrama,
Please try the following RealCode Indicator:
'# Period = UserInput.Integer = 5
Static Sum As Single
If isFirstBar Then
Sum = 0
Else If CurrentIndex <= Period
Sum += System.Math.Abs(Price.Last - Price.Last(1))
Else
Sum += System.Math.Abs(Price.Last - Price.Last(1)) - _
System.Math.Abs(Price.Last(Period) - Price.Last(Period+1))
End If
If CurrentIndex >= Period Then
Plot = (Price.Last - Price.Last(Period)) / (Sum + .0000001)
Else
Plot = Single.NaN
End If
The Period is adjustable. You can use Copy and Paste to get more than one in the same Pane.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
yuknus,
I do not know of a way to create a Personal Criteria Formula for ADX that is short enough to be practical. You may wish to review the following (especially the second topic referenced):
Average Directional Index (ADX)
Sorting by the ADX indicator
PCF for Wilder's Directional Movement DMI-crossovers
PCF for Wilder's DX, and/or a CI for Wilder's ADX
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/25/2007 Posts: 91
|
Bruce, Thanks a bunch. Appreciate it. Jay
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
jayrama,
You're welcome. Our pleasure.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |