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 |

RE: Inverse Fisher Transform Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
comptech2k
Posted : Saturday, April 9, 2005 5:09:55 PM
Registered User
Joined: 10/7/2004
Posts: 98
Hi Craig,
Long time no see--- looking for help for a custom indicator "Inverse Fisher Transform". Maybe you or Doug or anyone out there with the math skill sets can convert to tc2005.

Here is the meta version:

v1:=.1*(RSI(5)-50);
v2:=Mov(v1,9,W);
.5;
-.5;
(Exp(2*v2)-1)/(Exp(2*v2)+1)

Thanks,
ct2k
Doug_H
Posted : Sunday, April 10, 2005 12:40:09 AM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
The Inverse Fisher Transform is designed to help identify trigger points. It is a calculation that is applied to the values of another indicator, such as RSI. Here is the calculation I found:

y = ( Exp(2 * x) - 1 ) / ( Exp(2 * x) + 1 )

y is the Inverse Fisher Transform vslue to be calculated
x is the indicator value (RSI) that IFT is based on

I'm not sure how to apply the Exp. Perhaps someone with more understanding of this concept can help put this into PCF language, if it's possible.

- Doug
Teaching Online!
Craig_S
Posted : Sunday, April 10, 2005 9:55:39 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
What RSI setting did you want the formula to use?

- Craig
Here to Help!
comptech2k
Posted : Sunday, April 10, 2005 11:54:18 AM
Registered User
Joined: 10/7/2004
Posts: 98
I can only guess at the syntax meaning but I would assume v is volume, rsi is 5 referenced to 50 which is the mid point in rsi, Mov(v1,9,W)is a moving average of volume weighted 9, Exp means exponential ((Exp(2*v2)-1)/(Exp(2*v2)+1) ie. an exponential volume divided by another exponential volume, in the middle the .5 and -.5 is the lower and top levels for the indicator to pass through similar to a stoch which has a top of 80 and 20 at the bottom as a reference.







Craig_S
Posted : Monday, April 11, 2005 8:23:51 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
I see v1 defined in the code but it does not show up in the final formula. Both items in the final formula in the code are v2. I don't think v is volume but a variable defined in the first two lines.

Did this thing plot as a single line?

- Craig
Here to Help!
comptech2k
Posted : Tuesday, April 12, 2005 6:02:02 PM
Registered User
Joined: 10/7/2004
Posts: 98
Yes, and the line moves between -.5 and .5.
Craig_S
Posted : Tuesday, April 12, 2005 6:18:50 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
OK, let me see what I can come up with...

I have a feeling it won't be possible, but we shall see...

- Craig
Here to Help!
Craig_S
Posted : Wednesday, April 13, 2005 10:05:10 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
I think I have v2:

(XAVG(RSI5,9)-50)*.1

Plot as a custom indicator with ZERO LINE checked....

Working on the final formula... I am not optimistic.

- Craig
Here to Help!
Craig_S
Posted : Wednesday, April 13, 2005 10:12:12 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
(EXP((XAVG(RSI5,9)-50)*.2)-1)/(EXP((XAVG(RSI5,9)-50)*.2)+1)

Plot with zero line checked.

The values are not limited to (.5 to -.5) but to (1 to -1)

I have nothing to compare this to for accuracy. I will let the PCF superbrains here in the community evaluate it.


- Craig
Here to Help!
comptech2k
Posted : Wednesday, April 13, 2005 7:20:17 PM
Registered User
Joined: 10/7/2004
Posts: 98
Craig, I think you are on the right track but not quite there. I can help with the reference thing.
Your lines are in the right place (.5 to -.5)

I have not down-loaded today's data on one computer but still have yesterday's close (April 12,2005). I ran a scan on a small watchlist for cross-overs in meta(they are accurate).

The following crossed the .5 band up yesterday (colt) (Sp-500) and (ericy). As you can see your custom indicator in Tc2005 shows a cross of these three stocks 2 days ago.

The lower band cross-overs up (-.5) seemed to be a bit more eratic. The stocks (bby) (ewj)and (payx). The crossovers of the bottom band were whimpy on my meta scan. Reason was probably because of no firm commitment of the market yesterday.

Like I say your close with just a little something off. If you get a correction I can scan for several crossovers of the bands anytime in meta. My reason for wanting the conversion to tc2000 is I prefer to do most things in tc2000.
Thanks,
ct2k
bustermu
Posted : Wednesday, April 13, 2005 10:46:33 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
Craig,

I see nothing wrong with your results except that you used an Exponential Moving Average (EMA) in place of a Weighted Moving Average (WMA).

A WMA of period 9 has the same lag as an EMA of period of (2*9+1)/3 = 6.33... but more smoothing. So, if you choose not to use a WMA and use an EMA instead, the EMA period should probably be about 6 or 7, not 9.

Please ignore all apostrophes in the following. The Inverse Fisher Transform is better known as the hyperbolic tangent (tanh). It is given by all of the equivalent:

tanh('x')= (exp(2*x)-1)/(exp(2*x)+1)
= (exp('x')-exp(-x))/(exp('x')+exp(-x))
= (1-exp(-2*x))/(1+exp(-2*x))
= sinh('x')/cosh('x')

The tanh('x') function is a much used "soft-limiter". It is an odd function increases from -1 to +1 as x goes from -infinity to +infinity. It essentially leaves values near zero alone and compresses, or, flattens, the larger magnitudes back into the -1 to +1 interval. I suggest you plot it, or any of its equivalents, at any graphing web site, or on TC2005 even.

Thanks,
Jim Murphy
Craig_S
Posted : Thursday, April 14, 2005 7:16:05 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
ct2k,

Decrease the period (9) in the formula until it is closer and kills the lag.

bustermu,

Thanks for looking at it for me.

- Craig
Here to Help!
comptech2k
Posted : Thursday, April 14, 2005 1:01:40 PM
Registered User
Joined: 10/7/2004
Posts: 98
Thanks Craig,
you said "The values are not limited to (.5 to -.5) but to (1 to -1)" and it seems that after Jim's input that would mean the visual of the indicator crossing would be on april 12 instead of april 8 for a cross-over (sp-500)of the upper line if the visual upper band has a value of .5 rather than 1, I guess. In using your formula in order to visualize a cross-over wouldn't you want to increase the lag if the cross-over(sp-500) was on april 12 rather than april 8? I substituted 11 instead of 9 and it crossed on the 12th which is correct. So did (colt). But(ericy)gave a visual cross on the 11th a day early. Must be a bit more to it huh?

Jim,
thanks for your input and I am sure it is accurate judging from your past input to the forums. It has been 40 years since I had geometry, trig, algebra,or caculus so I can't follow you enough to create a custom indicator for tc2000.
ct2k
bustermu
Posted : Friday, April 15, 2005 7:21:25 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
ct2k,

1) You seem to be under the impression that increasing lag will always delay a level crossing. That is not true.

2) If you wish to duplicate what you have seen using the code you gave, use a WMA not an EMA.

3) Why don't you get rid of the Inverse Fisher Transform if you don't understand it? It is only a visual aid, it does not change transformed level crossings anyway.

Thanks,
Jim Murphy
Tanstaafl
Posted : Wednesday, May 18, 2005 9:09:25 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
OK let me take a shot at this one. I can't comment on BusterMu's trig comments, but I think I can shed some light on the original question that might help explain the issues. Some of these comments are repeats of what BusterMu mentioned earlier:

v1:=.1*(RSI(5)-50);
v2:=Mov(v1,9,W);
.5;
-.5;
(Exp(2*v2)-1)/(Exp(2*v2)+1)

Interpretation of the sytax is the first step.
The first two lines are variable definitions (that's what the := token is for).
So, you are supposed to substitute the formula defined for the variable v1 into the formula for variable v2. Note that v has nothing to do with volume. The expanded form of v2 would therefore be:
v2:= Mov( .1*(RSI(5)-50), 9, W )

And, similarly, the final formula
(Exp(2*v2)-1)/(Exp(2*v2)+1)
is using the v2 result as a variable, so the expanded form of THAT formula would be:
( Exp(2* Mov( .1*(RSI(5)-50), 9, W )
) -1 ) / ( Exp(2* Mov( .1*(RSI(5)-50), 9, W )
) +1 )

OK now to dissect the other stuff ...

1. Exp is simply "e" raised to the power of the Exp() argument. TC does it with the same sytax. No need to change it to make it work in TC.

2. RSI(5) is sneaky. It simply means the 5-period Wilder's RSI ... but TC's PCF RSI function does NOT model Wilder's RSI ... there's a long story here that you can check out with a Search for Wilder's RSI ... but what it boils down to is that in order to model it in TC you need to use (approximately) RSI9 or RSI10 instead of RSI5. If you want to see the difference, simply PLOT two RSI's on a chart, one with the "use Wilder's smoothing" checked, and one without it checked, for the same #periods. The lines are quite different. Now adjust the periods on the unchecked plot (to higher values) until you get a good fit. I think you will find that 9 is about right, using TC's nonstandard RSI calc, to emulate the standard Wilder RSI5. You can do it precisely, using the long PCF I posted in another thread, but hopefully this substitution will be close enough.

3. The Mov(x, 9, W) syntax refers to a 9-period Weighted moving average (as BusterMu said above). TC does not directly offer a Weighted average model, but it's easy enough to do. The 9-day Weighted average of Close is:
( 9*C + 8*C1 + 7*C2 + 6*C3 + 5*C4 + 4*C5 + 3*C6 + 2*C7 + C8 ) / (9+8+7+6+5+4+3+2+1)
Of course, this application calls for a pretty complex FORMULA to have the weighted average applied to it instead of just "C", but the principle is the same and can readily be applied in PCF-eze.

Expansion of that WtdMA formula using ".1*(RSI9.1-50)" in its place becomes:
.1 * ( 9*RSI9.1.0 + 8*RSI9.1.1 + 7*RSI9.1.2 + 6*RSI9.1.3 + 5*RSI9.1.4 + 4*RSI9.1.5 + 3*RSI9.1.6 + 2*RSI9.1.7 + RSI9.1.8 - (9+8+7+6+5+4+3+2+1)*50
) / (9+8+7+6+5+4+3+2+1)
or more cleanly:
( 9*RSI9.1.0 + 8*RSI9.1.1 + 7*RSI9.1.2 + 6*RSI9.1.3 + 5*RSI9.1.4 + 4*RSI9.1.5 + 3*RSI9.1.6 + 2*RSI9.1.7 + RSI9.1.8 - 2250 ) / 450

If you plug that in for the Mov(x,9,W) into the main formula ( Exp(2* Mov( .1*(RSI(5)-50), 9, W )
) -1 ) / ( Exp(2* Mov( .1*(RSI(5)-50), 9, W )
) +1 ) then you get the FINAL FORM of the PCF / Custom Indicator:

( Exp(2*
( 9*RSI9.1.0 + 8*RSI9.1.1 + 7*RSI9.1.2 + 6*RSI9.1.3 + 5*RSI9.1.4 + 4*RSI9.1.5 + 3*RSI9.1.6 + 2*RSI9.1.7 + RSI9.1.8 - (9+8+7+6+5+4+3+2+1)*50
) / (9+8+7+6+5+4+3+2+1)
) -1 ) / ( Exp(2*
( 9*RSI9.1.0 + 8*RSI9.1.1 + 7*RSI9.1.2 + 6*RSI9.1.3 + 5*RSI9.1.4 + 4*RSI9.1.5 + 3*RSI9.1.6 + 2*RSI9.1.7 + RSI9.1.8 - (9+8+7+6+5+4+3+2+1)*50
) / (9+8+7+6+5+4+3+2+1)
) +1 )

Try that on for size and see how it compares to your other source. Keep in mind that the RSI9 is only a close approximation to a true RSI5 ... but since it is being averaged the differences will probably be minimized enough to be acceptable.

Jim Dean
aka (removed by moderator) in Yahoo-land

comptech2k
Posted : Saturday, May 21, 2005 6:07:32 PM
Registered User
Joined: 10/7/2004
Posts: 98
Hi Jim,
Thanks for the interest. As you know the formula:

v1:=.1*(RSI(5)-50);
v2:=Mov(v1,9,W);
.5;
-.5;
(Exp(2*v2)-1)/(Exp(2*v2)+1)

inserted into the custom indicator module of meta will show the graphics for IFT consisting of a grid .5 (upper) and -.5 (lower)and the IFT line.

I am also posting here the exploration for the scan IFT crossing the upper grid today:
v1:=.1*(RSI(5)-50);
v2:=Mov(v1,9,W);
.5;
-.5;
InvFishTr:=(Exp(2*v2)-1)/(Exp(2*v2)+1);
Cross(InvFishTr,.5);

Also here is IFT crossing the lower grid up today:
v1:=.1*(RSI(5)-50);
v2:=Mov(v1,9,W);
.5;
-.5;
InvFishTr:=(Exp(2*v2)-1)/(Exp(2*v2)+1);
Cross(InvFishTr,-.5);

From a small watchlist today crossing the lower grid up today (at the close 5/20/05) is (BRKT)(VCMP)AND:
Crossing the upper grid up today is (AKAM) (ALOG)(ICGE) (NDAQ).(A word of caution to novices reading this-- do not buy these stocks on the strength of this one scan alone.)

Jim,I believe you mentioned you have a copy of metastock and with these scans you can see how they compare with a formula in tc2005.
The explorations I have posted here and the graphics are deadly accurate in showing the crossovers in metastock. That is the graphics match the scan perfectly.

In tc2005 I tried the custom indicator:
( Exp(2*
( 9*RSI9.1.0 + 8*RSI9.1.1 + 7*RSI9.1.2 + 6*RSI9.1.3 + 5*RSI9.1.4 + 4*RSI9.1.5 + 3*RSI9.1.6 + 2*RSI9.1.7 + RSI9.1.8 - (9+8+7+6+5+4+3+2+1)*50
) / (9+8+7+6+5+4+3+2+1)
) -1 ) / ( Exp(2*
( 9*RSI9.1.0 + 8*RSI9.1.1 + 7*RSI9.1.2 + 6*RSI9.1.3 + 5*RSI9.1.4 + 4*RSI9.1.5 + 3*RSI9.1.6 + 2*RSI9.1.7 + RSI9.1.8 - (9+8+7+6+5+4+3+2+1)*50
) / (9+8+7+6+5+4+3+2+1)
) +1 ) and did not get this indicator to show the crossing of the enclosed symbols. I may have done something wrong or misunderstood you, however.
Thanks, and good to have you back on the scene.
ct2k
Tanstaafl
Posted : Saturday, May 21, 2005 7:42:08 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Hi, Ct2k:

AFAIK, the translation of the formulae, etc is correct ... the only inherent inaccuracy is the RSI9 vs RSI5 approximation, which definitely does introduce some error. You might want to try this out in TC to get a feel for the error involved:

Plot RSI5 with the Wilder's Smoothing box checked, on the top pane
Plot RSI9 without the Wilder Smoothing, on the same pane.
Turn on the databox and compare values.

This situation prompted me to upgrade my big mamma Excel sheet to include Wtd MA's as one of my double-or-triple series-nesting options (along with Simple, Expon & Wilders). FWIW I have not encountered a situation in quite a while that required an addition the core capabilities of this 37Meg sheet ... congratulations, I guess :~)

From that, I was able to gen a True-Wilder's 5-day RSI, with error <0.1%, and apply a 9-day weighted MA to it, without having to write out 9 separate RSI series with independent weightings, to see how much the smoothed true RSI5 would differ from the approximated case that uses TC's internal RSI9 in place of RSI5.

When plotted, the formulae unfortunately appear to be offset by enough that it might cause errors that you would notice in the final InvFishTr.

So, here is a new chunk for you to plug in in place of the aprx wtd RSI5 snippet above - this is the equiv of meta's Mov(RSI(5),9,W) with less than 0.1% error:

100 - ( 100 / ( 1 + ( -40.033 * (C0-C1>0) * (C0-C1) -67.6113 * (C1-C2>0) * (C1-C2) -85.2258 * (C2-C3>0) * (C2-C3) -94.8693 * (C3-C4>0) * (C3-C4) -98.136 * (C4-C5>0) * (C4-C5) -96.3012 * (C5-C6>0) * (C5-C6) -90.3853 * (C6-C7>0) * (C6-C7) -81.2045 * (C7-C8>0) * (C7-C8) -69.4117 * (C8-C9>0) * (C8-C9) -55.5294 * (C9-C10>0) * (C9-C10) -44.4235 * (C10-C11>0) * (C10-C11) -35.5388 * (C11-C12>0) * (C11-C12) -28.431 * (C12-C13>0) * (C12-C13) -22.7448 * (C13-C14>0) * (C13-C14) -18.1959 * (C14-C15>0) * (C14-C15) -14.5567 * (C15-C16>0) * (C15-C16) -11.6453 * (C16-C17>0) * (C16-C17) -9.3163 * (C17-C18>0) * (C17-C18) -7.453 * (C18-C19>0) * (C18-C19) -5.9624 * (C19-C20>0) * (C19-C20) -4.7699 * (C20-C21>0) * (C20-C21) -3.8159 * (C21-C22>0) * (C21-C22) -3.0528 * (C22-C23>0) * (C22-C23) -2.4422 * (C23-C24>0) * (C23-C24) -1.9538 * (C24-C25>0) * (C24-C25) -1.563 * (C25-C26>0) * (C25-C26) -1.2504 * (C26-C27>0) * (C26-C27) -1.0003 * (C27-C28>0) * (C27-C28) -.8003 * (C28-C29>0) * (C28-C29) -.6402 * (C29-C30>0) * (C29-C30) -.5122 * (C30-C31>0) * (C30-C31) -.4097 * (C31-C32>0) * (C31-C32) -.3278 * (C32-C33>0) * (C32-C33) -.2622 * (C33-C34>0) * (C33-C34) -.2098 * (C34-C35>0) * (C34-C35) ) / ( 40.033 * (C0-C1<0) * (C0-C1) +67.6113 * (C1-C2<0) * (C1-C2) +85.2258 * (C2-C3<0) * (C2-C3) +94.8693 * (C3-C4<0) * (C3-C4) +98.136 * (C4-C5<0) * (C4-C5) +96.3012 * (C5-C6<0) * (C5-C6) +90.3853 * (C6-C7<0) * (C6-C7) +81.2045 * (C7-C8<0) * (C7-C8) +69.4117 * (C8-C9<0) * (C8-C9) +55.5294 * (C9-C10<0) * (C9-C10) +44.4235 * (C10-C11<0) * (C10-C11) +35.5388 * (C11-C12<0) * (C11-C12) +28.431 * (C12-C13<0) * (C12-C13) +22.7448 * (C13-C14<0) * (C13-C14) +18.1959 * (C14-C15<0) * (C14-C15) +14.5567 * (C15-C16<0) * (C15-C16) +11.6453 * (C16-C17<0) * (C16-C17) +9.3163 * (C17-C18<0) * (C17-C18) +7.453 * (C18-C19<0) * (C18-C19) +5.9624 * (C19-C20<0) * (C19-C20) +4.7699 * (C20-C21<0) * (C20-C21) +3.8159 * (C21-C22<0) * (C21-C22) +3.0528 * (C22-C23<0) * (C22-C23) +2.4422 * (C23-C24<0) * (C23-C24) +1.9538 * (C24-C25<0) * (C24-C25) +1.563 * (C25-C26<0) * (C25-C26) +1.2504 * (C26-C27<0) * (C26-C27) +1.0003 * (C27-C28<0) * (C27-C28) +.8003 * (C28-C29<0) * (C28-C29) +.6402 * (C29-C30<0) * (C29-C30) +.5122 * (C30-C31<0) * (C30-C31) +.4097 * (C31-C32<0) * (C31-C32) +.3278 * (C32-C33<0) * (C32-C33) +.2622 * (C33-C34<0) * (C33-C34) +.2098 * (C34-C35<0) * (C34-C35))))

If you plug in that series appropriately to the formula below, in lieu of the wtd RSI9 stuff:
.1 * ( 9*RSI9.1.0 + 8*RSI9.1.1 + 7*RSI9.1.2 + 6*RSI9.1.3 + 5*RSI9.1.4 + 4*RSI9.1.5 + 3*RSI9.1.6 + 2*RSI9.1.7 + RSI9.1.8 - (9+8+7+6+5+4+3+2+1)*50
) / (9+8+7+6+5+4+3+2+1)
... then you will end up with ...
= .1* ( (the series)/45 - 45*50/45 )
= .1* ( (the series)/45 - 50 )
= (the series)/450 - 5

... at this point I become lazy enough to let you take it from there and do the rest of the expansion, per my original post above.

This *should* be within about 0.1% of the meta control case ... if you need more RSI series accuracy (or less), please specify the desired cutoff (i.e. <1%, <0.5%, <0.05%, etc) and I will gen up an alternative nested 9-dy wtd average of the true RSI5 for you.

This has been an interesting problem. It UNDERLINES the need for Worden to provide a TRUE RSI function in their PCF language (along with a lot of other functions ;~)

I hope this helps!

Jim Dean
aka (removed by Moderator) in Yahoo-land

happy1398
Posted : Sunday, August 20, 2006 11:32:00 PM
Registered User
Joined: 11/14/2005
Posts: 77
hi all expert,
so which formula should i use it for IFT as a custom indicator in TC2005? sorry i don't really understand the formula but i simply want to use it in tc2005.
thank you
happy trading
Bruce_L
Posted : Monday, August 21, 2006 6:02:47 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
happy1398,
The best approximation in this topic so far that is usable as a Custom Indicator in TeleChart was given by Tanstaafl in his Wednesday, May 18, 2005 9:09:25 PM ET post:

( Exp(2*
( 9*RSI9.1.0 + 8*RSI9.1.1 + 7*RSI9.1.2 + 6*RSI9.1.3 + 5*RSI9.1.4 + 4*RSI9.1.5 + 3*RSI9.1.6 + 2*RSI9.1.7 + RSI9.1.8 - (9+8+7+6+5+4+3+2+1)*50
) / (9+8+7+6+5+4+3+2+1)
) -1 ) / ( Exp(2*
( 9*RSI9.1.0 + 8*RSI9.1.1 + 7*RSI9.1.2 + 6*RSI9.1.3 + 5*RSI9.1.4 + 4*RSI9.1.5 + 3*RSI9.1.6 + 2*RSI9.1.7 + RSI9.1.8 - (9+8+7+6+5+4+3+2+1)*50
) / (9+8+7+6+5+4+3+2+1)
) +1 )

A better approximation is suggested by Tanstaafl in his Saturday, May 21, 2005 7:42:08 PM ET post, but he did not actually make the formula substitutions. While usable as a Personal Criteria Formula, it would probably be too long and slow to be usable as a Custom Indicator. If a PCF suits your needs, a similar version calculated using nested parentheses instead of pre-calculated coefficients is available in my Monday, June 19, 2006 11:01:19 AM ET post in INVERSE FISHER TRANSFORM , ATT: CRAIG S..

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