Setting up a WilliamsPercentR alert on Thinkorswim


0
0

Hello! I am trying to set up an alert on thinkorswim platform with the Williams%R. The W%R has an overbought level of -20 and an oversold level of -80. I would like to add an alert that signals when the indicator crosses and closes below -20 and another alert for when the indicator crosses and closes above it’s -80 level. Closing would mean using the daily time frame candle closes. I am using a 5 period setting on the W%R. I also would like to use this on multiple forex pairs. Any help is greatly appreciated. Thanks!

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on October 15, 2019 5:51 am
118 views
0
I am going to update your question title so that it includes the full name of your study. You used the '%' sign in place of the word 'percent'. This will make your post difficult for searching engines to locate when other viewers are searching for WilliamsPercentR in Thinkorswim.
( at October 15, 2019 9:49 am)
0
Private answer

This only requires that we add 4 lines of code to the existing study. Here I have modified the source code that comes with Thinkorswim to make it easy to copy/paste.

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));
def crossBelowOB = wr[1] > overBought and wr < overBought;
def crossAboveOS = wr[1] < overSold and wr > overSold;
Alert(crossBelowOB[1], "WilliamsPercentR Overbought", Alert.BAR, Sound.RING);
Alert(crossAboveOS[1], "WilliamsPercentR, Oversold", Alert.BAR, Sound.RING);

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on October 15, 2019 9:56 am