Platinum Customer
Joined: 1/25/2005 Posts: 11
|
input stDevLength = 6;
input averageLength = 2;
input averageType = AverageType.EXPONENTIAL;
def stDevHi = StDev(high, stDevLength);
def stDevLo = StDev(low, stDevLength);
def avgStDevHiUp = MovingAverage(averageType, if high > high[1] then stDevHi else 0, averageLength);
def avgStDevHiDown = MovingAverage(averageType, if high < high[1] then stDevHi else 0, averageLength);
def avgStDevLoUp = MovingAverage(averageType, if low > low[1] then stDevLo else 0, averageLength);
def avgStDevLoDown = MovingAverage(averageType, if low < low[1] then stDevLo else 0, averageLength);
def rviHi = if avgStDevHiUp + avgStDevHiDown == 0 then 50 else 100 * avgStDevHiUp / (avgStDevHiUp + avgStDevHiDown);
def rviLo = if avgStDevLoUp + avgStDevLoDown == 0 then 50 else 100 * avgStDevLoUp / (avgStDevLoUp + avgStDevLoDown);
plot RVI = (rviHi + rviLo) / 2;
plot OverBought = 80;
plot OverSold = 20;
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following Indicator Formula in TC2000 v17.
(IIF(XAVG(IIF(H > H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2) + XAVG(IIF(H < H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2) = 0, 50, 100 * XAVG(IIF(H > H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2) / (XAVG(IIF(H > H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2) + XAVG(IIF(H < H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2))) + IIF(XAVG(IIF(L > L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2) + XAVG(IIF(L < L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2) = 0, 50, 100 * XAVG(IIF(L > L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2) / (XAVG(IIF(L > L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2) + XAVG(IIF(L < L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2)))) / 2
You can use it as the Formula in a Custom PCF Indicator if you want to plot it as an indicator on the chart.
If you do so, you may also want to change the Scaling... | Scale Method to 0 to 100 and add Horizontal Lines at 20 and 80.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Platinum Customer
Joined: 1/25/2005 Posts: 11
|
Thanks Bruce,
Venkat
|
Platinum Customer
Joined: 1/25/2005 Posts: 11
|
Bruce,
Looks like there is syntax error. I could not figure it out.
Venkat
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The formula is for TC2000 v17. A similar formula for older versions of TC2000 is too long and slow to be practical or post in the forums.
This means that if you are using a Mac, you would probably need to use emulation or virtualization software of some sort which would allow you to run Windows programs on a Mac so you can run TC2000 v17.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Platinum Customer
Joined: 1/25/2005 Posts: 11
|
How can I use scaling along with this script?
Thanks Venkat
QUOTE (Bruce_L)
Please try the following Indicator Formula in TC2000 v17.
(IIF(XAVG(IIF(H > H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2) + XAVG(IIF(H < H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2) = 0, 50, 100 * XAVG(IIF(H > H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2) / (XAVG(IIF(H > H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2) + XAVG(IIF(H < H1, SQR(ABS((SUM(H, 6) - SUM(H, 6) ^ 2 / 6) / 6)), 0), 2))) + IIF(XAVG(IIF(L > L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2) + XAVG(IIF(L < L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2) = 0, 50, 100 * XAVG(IIF(L > L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2) / (XAVG(IIF(L > L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2) + XAVG(IIF(L < L1, SQR(ABS((SUM(L, 6) - SUM(L, 6) ^ 2 / 6) / 6)), 0), 2)))) / 2
You can use it as the Formula in a Custom PCF Indicator if you want to plot it as an indicator on the chart.
If you do so, you may also want to change the Scaling... | Scale Method to 0 to 100 and add Horizontal Lines at 20 and 80.
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Click on the name of the Custom PCF Indicator at the top of the pane in which it is plotted and select Scaling and change the Scale method to 0 to 100.
Click on the name of the Custom PCF Indicator at the top of the pane in which it is plotted and select Horizontal Lines... | Add Line. Then repeat the process to add a second line.
Change At Value to 20.00 for one of the lines and 80.00 for the other line.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Platinum Customer
Joined: 1/25/2005 Posts: 11
|
Thanks Bruce
QUOTE (Bruce_L)
Click on the name of the Custom PCF Indicator at the top of the pane in which it is plotted and select Scaling and change the Scale method to 0 to 100.
Click on the name of the Custom PCF Indicator at the top of the pane in which it is plotted and select Horizontal Lines... | Add Line. Then repeat the process to add a second line.
Change At Value to 20.00 for one of the lines and 80.00 for the other line.
|