TC2000.com• Download software • Tutorial videos • Subscription & data-feed pricing • Class schedule
TC2000Brokerage.com• New account application • Trading resources • Margin rates • Stock & option commissions
Worden Discussion Forum » Customer Training & Support » Ask a Trainer - TC2000 version 12/18 » How do I conver this in TC2000?
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;
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.
Thanks Bruce,
Venkat
Bruce,
Looks like there is syntax error. I could not figure it out.
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.
How can I use scaling along with this script?
Thanks Venkat
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.
Thanks Bruce
You're welcome.