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 |

PCF to Realcode Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
jayrama
Posted : Tuesday, April 22, 2008 9:33:17 PM
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
StockGuy
Posted : Tuesday, April 22, 2008 9:48:29 PM

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)

jayrama
Posted : Tuesday, April 22, 2008 10:42:51 PM
Registered User
Joined: 4/25/2007
Posts: 91
StockGuy, Thanks, Jay
jayrama
Posted : Tuesday, April 22, 2008 11:03:41 PM
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
jayrama
Posted : Tuesday, April 22, 2008 11:16:38 PM
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
StockGuy
Posted : Tuesday, April 22, 2008 11:59:30 PM

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.

jayrama
Posted : Wednesday, April 23, 2008 1:20:00 AM
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

 

yuknus
Posted : Thursday, April 24, 2008 8:59:28 AM
Registered User
Joined: 3/23/2005
Posts: 3
A PCF formula for ADX  Prod 27 and AVG 3 ??
Bruce_L
Posted : Thursday, April 24, 2008 12:13:36 PM


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
Bruce_L
Posted : Thursday, April 24, 2008 12:26:51 PM


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
jayrama
Posted : Friday, April 25, 2008 12:15:51 AM
Registered User
Joined: 4/25/2007
Posts: 91
Bruce, Thanks a bunch. Appreciate it. Jay
Bruce_L
Posted : Friday, April 25, 2008 8:01:34 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
jayrama,
You're welcome. Our pleasure.

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