Double IFTS For ThinkOrSwim

Rich-Trader

New member
This is a pic and code for an Inverse Fisher Transform Stochastic that i was able to with help from Chat AI and a little tweaking by study to create. It uses two stochastics and two smoothing I only use two stochastics I set them at 5 and 60 and only run the smoothing for the 60 Stoch set at 60 currently. It also plots a background color of red when ever there is downward momentum and green whenever there is upward momentum. The darker colors are when both stochastics plot at same time.

Wkx4ZCmT
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

This is a pic and code for an Inverse Fisher Transform Stochastic that i was able to with help from Chat AI and a little tweaking by study to create. It uses two stochastics and two smoothing I only use two stochastics I set them at 5 and 60 and only run the smoothing for the 60 Stoch set at 60 currently. It also plots a background color of red when ever there is downward momentum and green whenever there is upward momentum. The darker colors are when both stochastics plot at same time.

This is the code for any feel free to try and code for TOS If you want
Wkx4ZCmT

//@version=5
// author Rich Darnell
// creator John EHLERS
//
indicator('MKT SS Ver2', shorttitle='SS Ver2')
// Define the first stochastic plot
stochlength = input(5, 'STOCH Length')
wmalength = input(5, title='Smoothing length')
v1 = 0.1 * (ta.stoch(close, high, low, stochlength) - 50)
v2 = ta.wma(v1, wmalength)
INV = (math.exp(2 * v2) - 1) / (math.exp(2 * v2) + 1)
// Determine the direction of the first stochastic plot
dir = v1 > v2 ? 1 : v1 < v2 ? -1 : 0
// Define the colors for the first stochastic plot
c1 = dir == 1 ? color.green : dir == -1 ? color.red : color.blue
// Plot the first stochastic plot and its smoothing line
plot(INV, color=c1, linewidth=2)
plot(ta.wma(INV, wmalength), color=dir == 1 ? color.green : color.red, linewidth=1)
// Define parameters for the second stochastic plot
stochlength2 = input(30, 'STOCH Length 2')
wmalength2 = input(30, title='Smoothing length 2')
v3 = 0.1 * (ta.stoch(close, high, low, stochlength2) - 50)
v4 = ta.wma(v3, wmalength2)
INV2 = (math.exp(2 * v4) - 1) / (math.exp(2 * v4) + 1)
// Determine the direction of the second stochastic plot
dir2 = v3 > v4 ? 1 : v3 < v4 ? -1 : 0
// Define the colors for the second stochastic plot
c2 = dir2 == 1 ? color.green : dir2 == -1 ? color.red : color.blue
// Plot the second stochastic plot and its smoothing line
plot(INV2, color=c2, linewidth=2)
plot(ta.wma(INV2, wmalength2), color=dir2 == 1 ? color.green : color.red, linewidth=1)
// Plot the background color for the trigger bar V1
bgcolor(dir > 0 and v1 > 0.5 ? color.green : dir < 0 and v1 < -0.5 ? color.red : na, transp=80)
// Plot the background color for the trigger bar V3
bgcolor(dir > 0 and v3 > 0.5 ? color.green : dir < 0 and v3 < -0.5 ? color.red : na, transp=80)
hline(0, color=color.gray)
hline(0.5, color=color.red)
hline(-0.5, color=color.green)
below TOS version.
CSS:
#//@version=5
#// author Rich Darnell
#// creator John EHLERS
#indicator('MKT SS Ver2', shorttitle='SS Ver2')
#// Define the first stochastic plot
declare lower;
input stochlength = 5;#, 'STOCH Length')
input wmalength = 5;#, title='Smoothing length')
input stochlength2 = 30;#, 'STOCH Length 2')
input wmalength2 = 30;#, title='Smoothing length 2')

def last = isNaN(close);
def na = Double.NaN;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;
# stoch(source, high, low, length) =>
script stoch {
input src = close;
input h = high;
input l = low;
input len = 0;
    def stoch = 100 * (src - lowest(l, len)) / (highest(h, len) - lowest(l, len));
    plot return = stoch;
}

def v1 = 0.1 * (stoch(close, high, low, stochlength) - 50);
def v2 = WMA(v1, wmalength);
def INV = (Exp(2 * v2) - 1) / (Exp(2 * v2) + 1);
#// Determine the direction of the first stochastic plot
def dir = if v1 > v2 then 1 else
          if v1 < v2 then -1 else 0;
#// Define the colors for the first stochastic plot
#// Plot the first stochastic plot and its smoothing line

plot firstStoc = INV;#, color=c1, linewidth=2)
firstStoc.SetLineWeight(2);
firstStoc.AssignValueColor(if dir==1 then Color.GREEN else
                           if dir==-1 then Color.RED else Color.BLUE);
plot wma1Line = WMA(INV, wmalength);#, color=dir == 1 ? color.green : color.red, linewidth=1)
wma1Line.AssignValueColor(if dir == 1 then color.DARK_green else color.DARK_red);
#// Define parameters for the second stochastic plot

def v3 = 0.1 * (stoch(close, high, low, stochlength2) - 50);
def v4 = WMA(v3, wmalength2);
def INV2 = (Exp(2 * v4) - 1) / (Exp(2 * v4) + 1);
#// Determine the direction of the second stochastic plot
def dir2 = if v3 > v4 then 1 else
           if v3 < v4 then -1 else 0;
#// Define the colors for the second stochastic plot
#c2 = dir2 == 1 ? color.green : dir2 == -1 ? color.red : color.blue
#// Plot the second stochastic plot and its smoothing line
plot SecondStoc = INV2;#, color=c2, linewidth=2)
SecondStoc.SetLineWeight(2);
SecondStoc.AssignValueColor(if dir2==1 then Color.CYAN else
                            if dir2==-1 then Color.MAGENTA else Color.GRAY);
plot wma2Line = WMA(INV2, wmalength2);#, color=dir2 == 1 ? color.green : color.red, linewidth=1)
wma2Line.AssignValueColor(if dir2 == 1 then color.VIOLET else color.PLUM);
#// Plot the background color for the trigger bar V1
AddCloud(if dir > 0 and v1 > 0.5 then pos else if dir < 0 and v1 < -0.5 then neg else na,
         if dir > 0 and v1 > 0.5 then neg else if dir < 0 and v1 < -0.5 then pos else na, Color.DARK_GREEN, Color.DARK_RED);
#// Plot the background color for the trigger bar V3
AddCloud(if dir > 0 and v3 > 0.5 then pos else if dir < 0 and v3 < -0.5 then neg else na,
         if dir > 0 and v3 > 0.5 then neg else if dir < 0 and v3 < -0.5 then pos else na, Color.DARK_GREEN, Color.DARK_RED);
#bgcolor(dir > 0 and v3 > 0.5 ? color.green : dir < 0 and v3 < -0.5 ? color.red : na, transp=80)

plot hline0 = if last then na else 0;#, color=color.gray)
plot hline1 = if last then na else 0.5;#, color=color.red)
plot hline2 = if last then na else -0.5;#, color=color.green)

hline0.SetStyle(Curve.SHORT_DASH);
hline0.SetDefaultColor(Color.GRAY);
hline1.SetDefaultColor(Color.GRAY);
hline2.SetDefaultColor(Color.GRAY);


#--- END of CODE
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
255 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top