Looking for some assistance in adding the overbought and oversold clouds to the W%R. On the overbought from the 0 to -20 and oversold from -80 to -100. On the same idea as the RSI Lagueere or TMO Thanks
Was wondering if anyone is able to create a Williams Percent Stand Alone Arrows - Arrow up when it hits a certain number (negative_onehundred or if you can just manually plot it to any number) and an Arrow down when it hits a certain number (zerobase or if you can just manually plot to any number)?
I took a stab at this myself but I had a gazillion arrows and lines flying off my screen and into my living reality to where you could literally touch them -- it was a scene man. Alright, thanks in advance
I'm really bad at coding, I've been trying to figure out how to do this by looking at other code with buy/sell arrows but I can't get it to work. Basically I just need an up arrow when the %R crosses above oversold and a down arrow when %R crosses below overbought. I would also like the option to change the color of the arrows and also the option to plot them or not, but these two are really not necessary. The arrows are the most important part.
Here's my attempt, top half is the copy/pasted W%R and the bottom half is my attempt :
The TOS plot statement is used to state where you want the arrow to plot an example would be:
Ruby:
plot UpSignal = if WR > overBought then WR else Double.NaN ;
plot DownSignal = if WR < overSold then WR else Double.NaN ;
You already have the ability to change color or plot your arrows. Click on the gear icon next to the study in your chart. Unclick plot if you don't want to plot. Click on the color to change the color.
The TOS plot statement is used to state where you want the arrow to plot an example would be:
Ruby:
plot UpSignal = if WR > overBought then WR else Double.NaN ;
plot DownSignal = if WR < overSold then WR else Double.NaN ;
You already have the ability to change color or plot your arrows. Click on the gear icon next to the study in your chart. Unclick plot if you don't want to plot. Click on the color to change the color.
Thanks for the response dude, but that code didn't work for me. It came out looking like this after I fixed the parameters:
This was the code I added:
Code:
plot UpSignal = if WR > overSold then WR else Double.NaN ;
plot DownSignal = if WR < overBought then WR else Double.NaN ;
The first issue was obviously it being highlighted everywhere. Second issue was it didn't even turn red after the crossunders like before 6:35 and at 6:45, and thirdly it isn't an up/down arrow it just highlights the line. So I tried something like this:
Code:
plot UpSignal = if WR crosses above overSold then WR else Double.NaN ;
plot DownSignal = if WR crosses below overBought then WR else Double.NaN ;
That didn't work either. Then finally I tried this:
Code:
plot ARROW_UP = if WR crosses above overSold then WR else Double.NaN ;
plot ARROW_DOWN = if WR crosses below overBought then WR else Double.NaN ;
And this didn't work either. So I don't really know what to do. For reference, here's the whole code:
Code:
declare lower;
input length = 10;
input overBought = -20;
input overSold = -80;
def hh = Highest(high, length);
def ll = Lowest(low, length);
def result = if hh == ll then -100 else (hh - close) / (hh - ll) * (-100);
plot WR = if result > 0 then 0 else result;
WR.SetDefaultColor(GetColor(1));
plot Over_Sold = overSold;
Over_Sold.SetDefaultColor(GetColor(8));
plot Over_Bought = overBought;
Over_Bought.SetDefaultColor(GetColor(8));
#My code below-----
plot ARROW_UP = if WR crosses above overSold then WR else Double.NaN ;
plot ARROW_DOWN = if WR crosses below overBought then WR else Double.NaN ;
I keep coming back and throw this on my charts, thought I'd share and try to give back something.
Basically provides some color coded wedges whenever we cross over bought, oversold and midpoint.
I mainly trade daily charts end of day so I'm one of those with a messy chart but the decision to Buy Sell or Hold can be made at a glance (30 sec)
The cross overs add a warm fuzzy feeling to confirm a buy or sell signal when they're in sync.
Also added a label of current status, Overbought Oversold above below -50 etc
You can turn labels on or off, set length, midpoint, overbought, oversold and if you want to trade them or not ( turns on/off oversold, overbought, and midpoint.
Originally I had this code in a trade strategy, mainly as a fail-safe to sell at midpoint.
Not a coder per say so any thoughts for improvement
Code:
# Williams %R Trader
#Mod: atcsam 04/19/22
input length = 10;
input overBought = -20;
input overSold = -80;
input midpoint = -50;
input Label = Yes;
input TradeMidpoint = Yes;
input TradeOverBought = Yes;
input TradeOverSold = Yes;
def hh = Highest(high, length);
def ll = Lowest(low, length);
def result = if hh == ll then -100 else (hh - close) / (hh - ll) * (-100);
def WR = if result > 0 then 0 else result;
## Midpoint
def BuyMidX = if WR crosses above midpoint and TradeMidpoint then midpoint else Double.NaN;
def SellMidX = if WR crosses below midpoint and TradeMidpoint then midpoint else Double.NaN;
plot AboveMid = BuyMidX;
AboveMid.SetDefaultColor(Color.WHITE);
AboveMid.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
plot BelowMid = SellMidX;
BelowMid.SetDefaultColor(Color.WHITE);
BelowMid.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
## OverBought
def BuyOverBoughtX = if WR crosses above overBought and TradeOverBought then overBought else Double.NaN;
def SellOverBoughtX = if WR crosses below overBought and TradeOverBought then overBought else Double.NaN;
plot AboveOB = BuyOverBoughtX;
AboveOB.SetDefaultColor(Color.YELLOW);
AboveOB.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
plot BelowOB = SellOverBoughtX;
BelowOB.SetDefaultColor(Color.YELLOW);
BelowOB.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
## OverSold
def BuyOverSoldX = if WR crosses above overSold and TradeOverSold then overSold else Double.NaN;
def SellOverSoldX = if WR crosses below overSold and TradeOverSold then overSold else Double.NaN;
plot AboveOS = BuyOverSoldX;
AboveOS.SetDefaultColor(Color.CYAN);
AboveOS.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
plot BelowOS = SellOverSoldX;
BelowOS.SetDefaultColor(Color.CYAN);
BelowOS.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
# Labels
AddLabel (yes, if Label then " W%R:" else "", Color.WHITE);
AddLabel (yes, if Label and (WR > -20) and (WR > WR[1]) then "Over Bought Rising " else if Label and (WR > -20) and (WR < WR[1]) then "Over Bought Falling" else
if (WR < -80) then "Over Sold" else "", if (WR > -20) then Color.YELLOW else if (WR < -80) then Color.LIGHT_GREEN else Color.LIGHT_GRAY );
AddLabel(yes,
if ((WR > -50 and WR < -20) and (WR > WR[1])) then "Above 50 & Rising" else
if ((WR > -50 and WR < -20) and (WR < WR[1])) then "Above 50 & Falling" else
if ((WR < -50 and WR > -80) and (WR < WR[1])) then "Below 50 & Falling" else
if ((WR < -50 and WR > -80) and (WR > WR[1])) then "Below 50 & Rising" else
"",
if ((WR > -50) and (WR > WR[1])) then Color.GREEN else
if ((WR > -50) and (WR < WR[1])) then Color.PINK else
if ((WR < -50) and (WR < WR[1])) then Color.LIGHT_RED else
if ((WR < -50) and (WR > WR[1])) then Color.LIME else
Color.RED);
TQQQ
Basicichart indicator only. You can see Cyan Hats (Oversold) alternating on its way down, crossing below oversold again today. Downtrend started when it bounced in out of overbought, into overbought (yellow wedges) , below midpoint (white wedge), bouncing oversold remainder of the way down.
Is it possible to modify the following script to use as a watchlist script with the over bought cross (-10) being shown as a Red color; the over sold cross (-90_ being a green bar and have a neutral color (white) for when no cross is occurring? Thank you for taking a look.
What would be the correct logic to identify a "double tap" of the Williams indicator? Something that approached and may or may not fully cross over the -80 line. I was thinking I could look for slope changes from positive to negative along with a peak value that was say greater than -70?
What would be the correct logic to identify a "double tap" of the Williams indicator? Something that approached and may or may not fully cross over the -80 line. I was thinking I could look for slope changes from positive to negative along with a peak value that was say greater than -70?
I do not know the answer to your question. I am hoping some one can convert the above script so it can be used on TOS watchlist. However, here is a photo of Williams%r with a 13 EMA overlaid on it.
I think this is an excellent way to get an early signal.
You may want to try to change the over bought to -10 and the over sold to -90.
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.
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.