IWO Turning Point Indicator for ThinkorSwim

horserider

Well-known member
VIP
Here is the IWO Turning Point indicator for ThinkorSwim. You can trade options with it. Usage and trading notes can be found in the code below.

tUMUTDa.png


16:08 FrankB3: Received e-mail from a trader, given me: IWO Turning Point Indicator (TPI) : tried to make a header and notes, best I can. http://tos.mx/8fm8ji

Code:
# IWO Turning Point Indicator BY STEVEN PLACE (12/5/18)
#The TPI is a way to quantify the rate of change of a stock or market.
#It gives you specific levels that shows the probabilities of a move in a stock. The TPI has a few components.
#The first is the “Rolling” line. This shows us the rolling returns of a stock for whatever timeframe we want.
#The default setting is a period of 10 trading days, which is the equivalent of 2 weeks.
#So, for an example, if a stock is a reading of 4.7%, that means it has rallied 4.7% over 10 trading days.

#The rest of the lines are volatility bands, using a 60-day sample. 60 days is about 3 calendar months.
#The indicator looks back at all of the rolling returns data, and calculates the standard deviations.
#This is important because it gives us context for a stock.
#As an example, you can say “oh wow, this stock has moved big.”
#But the other questions to ask are…
#1. How big? 2. Has it happened in the past? 3. What kind of moves should we expect?
#The volatility bands are a guide.
#In the chart above, the upper volatility band is at 7.55%.
#What does this mean?

#It means we should expect, about 95% of the time, for the stock to not rally 7.5%.
#And with options trading, it’s just as important to know where a stock isn’t headed just as much as to where it is.

#The sweet spot is at 30 days to expiration.
#If you can capture 50% of maximum credit with 30 days left to expiration, that's a good exit.
#If you can capture 20% of maximum credit after being in the trade for only 10 days, that's also a good exit.
#The goal here is to maximize returns and minimizing time in the market. WHAT TIMEFRAMES TO USE
#There are few timeframes that I follow. Each has its own reasoning, but it basically comes down to how much a stock has moved…
#… in the past week
#… in the past two weeks
#… in the past month
#… in the past 3 months
#Your trading style and strategy choice will dictate what kind of timeframe you need to use.
#Here are the inputs for each timeframe:


#One week (5, 60)
#Two weeks (10, 60)
#One Month (20, 80)
#Three Months (60, 252)
#Because we only look at trading days not calendar days, our numbers are shortened.
#Oh, and that “252” is because there are 252 trading days in a year. Neat, right? HOW TO TRADE WITH THE TPI:
#The TPI is an indicator best suited with looking for reversion-based moves.
#Simply put, you wait for an expansion in volatility and then fade any further moves from that.
#Let’s take an example.
#A stock is trading in a long-term uptrend with a closing price of 155, then over a 10-day period it moves -8%. That’s below its 2nd standard deviation band.
#Its closing price is 142.
#Now the odds of seeing downside continuation are very low, especially within the next 10 days. So, you can look to structure a bull put spread, an option strategy that profits as long as the stock doesn’t move below a certain strike price.
#The cool part? You can use the TPI to figure out where you should place that strike price.

#So you can move the timeframe of the TPI out to 20 days, and then you get this chart:

#The lower band shows -6%, which means that based on the past 3 months volatility the odds of seeing a selloff greater than that is around 5%.
#And given the fact that the stock is already deeply oversold, the odds are further in your favor.
#Put it all together.
##The stock is statistically oversold, with a closing price of $142 per share.
#6% off that current price is around 133.
#So you can sell the 130/125 credit spread for around 0.65.
#With a max reward of 65 and a risk of 435, that puts your return on risk at 14%.
#Do the math!
#The reward relative to the risk is much higher than the statistical odds!

declare lower;input length = 10;input stdLength = 60;plot rolling = (close - close[length])*100/close[length];plot updev = StDev(rolling, stdLength);plot twoupdev = 2*StDev(rolling, stdLength);plot downdev = -StDev(rolling, stdLength);plot twodowndev = -2*StDev(rolling, stdLength);

 

Attachments

  • tUMUTDa.png
    tUMUTDa.png
    298.3 KB · Views: 188

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Thanks! Scans with this work well: rolling below twodowndev, aggregated to H with my normal up-trending stocks. Can really find some nice uphill price pothole pullbacks. Will test this out a bit tomorrow.
 
Last edited:
i really kinda like this, too. what i did to weed out false signals (and prolly add some, too, ha ha) is combine it with another similar indicator called valuecompare. relatively few buy sigs but when they come, they seem pretty good, at least if you're a mean revisionist. see code below. thoughts, anyone? and sorry for how sloppy my combo code is; i'm basically winging it. wish i could remember who wrote valuecompare. rest assured it wasn't me.



Code:
input length = 5;

def VarP = Round(length / 5);
def VarA = Highest(high, VarP) - Lowest(low, VarP);
def VarR1 = if VarA == 0 and VarP == 1 then AbsValue(close - close[VarP]) else VarA;
def VarB = Highest(high, VarP)[VarP + 1] - Lowest(low, VarP)[VarP];
def VarR2 = if VarB == 0 and VarP == 1 then AbsValue(close[VarP] - close[VarP * 2]) else VarB;
def VarC = Highest(high, VarP)[VarP * 2] - Lowest(low, VarP)[VarP * 2];

def VarR3 = if VarC == 0 and VarP == 1 then AbsValue(close[VarP * 2] - close[VarP * 3]) else VarC;

def VarD = Highest(high, VarP)[VarP * 3] - Lowest(low, VarP)[VarP * 3];
def VarR4 =
if VarD == 0 and VarP == 1 then AbsValue(close[VarP * 3] - close[VarP * 4]) else VarD;

def VarE = Highest(high, VarP)[VarP * 4] - Lowest(low, VarP)[VarP * 4];
def VarR5 = if VarE == 0 and VarP == 1 then AbsValue(close[VarP * 4] - close[VarP * 5]) else VarE;

def LRange = ((VarR1 + VarR2 + VarR3 + VarR4 + VarR5) / 5) * 0.2;

def Var0 = if AbsValue(close - close[1]) > (high - low) then AbsValue(close - close[1]) else (high - low);
def LRange2 = if high == low then Average(AbsValue(close - close[1]), 5) * 0.2 else Average(Var0, 5) * 0.2;

def range = high + low;
def delta = high - low;
def median = range / 2;
def floatingAxis = Average(median, length);
def dynamicVolatilityUnit = if length <= 7 then LRange2 else LRange;
def relativeHigh = (high - floatingAxis) / dynamicVolatilityUnit;
def relativeLow = (low - floatingAxis) / dynamicVolatilityUnit;
def relativeOpen = (open - floatingAxis) / dynamicVolatilityUnit;
def relativeClose = (close - floatingAxis) / dynamicVolatilityUnit;



def "High" = relativeHigh;


def "Low" = relativeLow;




input length2 = 10;
input stdLength = 60;

def rolling = (close - close[length2]) * 100 / close[length2];

def updev = StDev(rolling, stdLength);

def twoupdev = 2 * StDev(rolling, stdLength);

def downdev = -StDev(rolling, stdLength);

def twodowndev = -2 * StDev(rolling, stdLength);


plot combined = rolling <= downdev and "Low" <= -8;

plot sell = rolling >= updev and "high" >= 8;

combined.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

sell.setpaintingstrategy (paintingstrategy.histogram);

combined.AssignValueColor (if combined then Color.GREEN else if sell then Color.RED else color.gray);

combined.SetLineWeight(2);
 
Last edited by a moderator:
Code:
input length = 5;

def VarP = Round(length / 5);
def VarA = Highest(high, VarP) - Lowest(low, VarP);
def VarR1 = if VarA == 0 and VarP == 1 then AbsValue(close - close[VarP]) else VarA;
def VarB = Highest(high, VarP)[VarP + 1] - Lowest(low, VarP)[VarP];
def VarR2 = if VarB == 0 and VarP == 1 then AbsValue(close[VarP] - close[VarP * 2]) else VarB;
def VarC = Highest(high, VarP)[VarP * 2] - Lowest(low, VarP)[VarP * 2];

def VarR3 = if VarC == 0 and VarP == 1 then AbsValue(close[VarP * 2] - close[VarP * 3]) else VarC;

def VarD = Highest(high, VarP)[VarP * 3] - Lowest(low, VarP)[VarP * 3];
def VarR4 =
if VarD == 0 and VarP == 1 then AbsValue(close[VarP * 3] - close[VarP * 4]) else VarD;

def VarE = Highest(high, VarP)[VarP * 4] - Lowest(low, VarP)[VarP * 4];
def VarR5 = if VarE == 0 and VarP == 1 then AbsValue(close[VarP * 4] - close[VarP * 5]) else VarE;

def LRange = ((VarR1 + VarR2 + VarR3 + VarR4 + VarR5) / 5) * 0.2;

def Var0 = if AbsValue(close - close[1]) > (high - low) then AbsValue(close - close[1]) else (high - low);
def LRange2 = if high == low then Average(AbsValue(close - close[1]), 5) * 0.2 else Average(Var0, 5) * 0.2;

def range = high + low;
def delta = high - low;
def median = range / 2;
def floatingAxis = Average(median, length);
def dynamicVolatilityUnit = if length <= 7 then LRange2 else LRange;
def relativeHigh = (high - floatingAxis) / dynamicVolatilityUnit;
def relativeLow = (low - floatingAxis) / dynamicVolatilityUnit;
def relativeOpen = (open - floatingAxis) / dynamicVolatilityUnit;
def relativeClose = (close - floatingAxis) / dynamicVolatilityUnit;



def "High" = relativeHigh;


def "Low" = relativeLow;




input length2 = 10;
input stdLength = 60;

def rolling = (close - close[length2]) * 100 / close[length2];

def updev = StDev(rolling, stdLength);

def twoupdev = 2 * StDev(rolling, stdLength);

def downdev = -StDev(rolling, stdLength);

def twodowndev = -2 * StDev(rolling, stdLength);


plot combined = rolling <= downdev and "Low" <= -8;

plot sell = rolling >= updev and "high" >= 8;

combined.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

sell.setpaintingstrategy (paintingstrategy.histogram);

combined.AssignValueColor (if combined then Color.GREEN else if sell then Color.RED else color.gray);

combined.SetLineWeight(2);
Is it a lower study?! how to make it work as a lower study
 
Last edited by a moderator:

Volatility Trading Range

VTR is a momentum indicator that shows if a stock is overbought or oversold based on its Weekly and Monthly average volatility trading range.

Download the indicator

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
512 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