Registered User Joined: 12/30/2004 Posts: 369
|
Hello,
This is what I have of a "Random Walk Index Indicator." Is there any way that you can make a custom indicator out of it? Thanks. -amberpax
("RWIHI"); minperiods = Param( "Min Periods", 9, 1, 200, 1 ); maxperiods = Param( "Max Periods", 40, 1, 200, 1 ); Plot( RWIHi( minperiods, maxperiods) , _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); _SECTION_END();
|

 Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
This code does not reveal how this indicator is calculated. Do you have a description of the indicator? What does the indicator do that makes you want to use it?
- Craig Here to Help!
|
Registered User Joined: 12/30/2004 Posts: 369
|
(URL removed by Moderator)
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Here's my guess based on the example code provided:
9-Period ST Random Walk Index High:
Max( (H - L1) / (AVG(TR1,2) * SQR(2)), (H - L2) / (AVG(TR1,3) * SQR(3)), (H - L3) / (AVG(TR1,4) * SQR(4)), (H - L4) / (AVG(TR1,5) * SQR(5)), (H - L5) / (AVG(TR1,6) * SQR(6 )), (H - L6) / (AVG(TR1,7) * SQR(7)), (H - L7) / (AVG(TR1,8) * SQR(8)), (H - L8) / (AVG(TR1,9) * SQR(9)) )
9-Period ST Random Walk Index Low:
Max( (H1 - L) / (AVG(TR1,2) * SQR(2)), (H2 - L) / (AVG(TR1,3) * SQR(3)), (H3 - L) / (AVG(TR1,4) * SQR(4)), (H4 - L) / (AVG(TR1,5) * SQR(5)), (H5 - L) / (AVG(TR1,6) * SQR(6 )), (H6 - L) / (AVG(TR1,7) * SQR(7)), (H7 - L) / (AVG(TR1,8) * SQR(8)), (H8 - L) / (AVG(TR1,9) * SQR(9)) )
Where TR1:
(H1 - L1 + ABS(H1 - C2) + ABS(C2 - L1)) / 2
To do the MAX function (which creates the biggest problem in reproducing this as a formula), it would be possible to substitute each of the nine lines in the following (other methods are also possible, but are probably not much shorter if at all):
(A + B + ABS(A - B) + 2 * (C ) + ABS(A + B + ABS(A - B) - 2 * (C )) + 2 * (D + E + ABS(D - E)) + ABS(A + B + ABS(A - B) + 2 * (C ) + ABS(A + B + ABS(A - B) - 2 * (C )) - 2 * (D + E + ABS(D - E))) + 2 * (F + G + ABS(F - G) + H + I + ABS(H - I) + ABS(F + G + ABS(F - G) - H - I - ABS(H - I))) + ABS(A + B + ABS(A - B) + 2 * (C ) + ABS(A + B + ABS(A - B) - 2 * (C )) + 2 * (D + E + ABS(D - E)) + ABS(A + B + ABS(A - B) + 2 * (C ) + ABS(A + B + ABS(A - B) - 2 * (C )) - 2 * (D + E + ABS(D - E))) - 2 * (F + G + ABS(F - G) + H + I + ABS(H - I) + ABS(F + G + ABS(F - G) - H - I - ABS(H - I))))) / 16
For 9-Period ST Random Walk Index High for example:
A = (H - L1) / (AVG(TR1,2) * SQR(2)) B = (H - L2) / (AVG(TR1,3) * SQR(3)) etc.
Of course we haven't actually substituted TR1 yet:
AVG(TR1,2) = (AVG(H1,2) - AVG(L1,2) + (ABS(H1 - C2) + ABS(H2 - C3) + ABS(C2 - L1) + ABS(C3 - L2)) / 2) / 2 AVG(TR1,3) = (AVG(H1,3) - AVG(L1,3) + (ABS(H1 - C2) + ABS(H2 - C3) + ABS(H3 - C4) + ABS(C2 - L1) + ABS(C3 - L2) + ABS(C4 - L3)) / 3) / 2 etc. (they just keep getting longer)
Some simplification is probably possible because some of the terms will be duplicated in the comparisons (but I haven't actually tried it, combining the terms could actually make things worse and not be desirable).
The 50-Period LT Random Walks would be the sum of the last 40-Periods of the above. The result would probably exceed the 32768 character limit of copy and paste in Windows if created as a Personal Criteria Formula. The easiest way to do this as a Custom Indicator would be to multiply the above by 40, set the Average Period to 40 and the Average Type to Simple.
Assuming I'm correct about what it would take (a big assumption considering I've never used Metastock), I don't think it is practical as either a PCF or CI, but hopefully I'm missing something and this presentation will prompt a better idea.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 12/30/2004 Posts: 369
|
Craig and Bruce, Thank you for your help. I have a free chart site that incorporates this Random Walk Indicator and I have found it to be rather iteresting and workable. Of course, I wanted to incorporate this in my Telechart program, but it seems to be just much too cumbersome. Again thank you both, -amberpax.
|