Add Line 50 to WilliamsPercentR?


Category:
0
0

Hi Pete,

How do you add codes for line 50 to WilliamsPercentR (see attached screenshot)? Thanks.


#
# TD Ameritrade IP Company, Inc. (c) 2007-2019
#

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));


 

Attachments:
Marked as spam
Posted by (Questions: 23, Answers: 57)
Asked on March 11, 2019 7:19 am
172 views
0
( at March 14, 2019 9:13 am)
0
Private answer

plot midLine = -50;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 6, 2019 8:23 am
0
Hi Pete, How do you use this code to make it green cloud above 50 and red cloud below 50: AddCloud(centerLine, Color.GREEN, Color.RED); (this line does not work) Please advise. Thanks!
( at February 6, 2020 5:09 pm)
0
The AddCloud() function requires 4 parameters in order to work. Your attempt only includes three. Full details here: https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AddCloud So you must include the WR as well as the midLine variables as the first two parameters. The order in which you include them determines which color is applied above midLine versus below midLine. You will need to experiment to find the one that works for you.
( at February 6, 2020 6:40 pm)
0
Thank you! It worked.
( at February 6, 2020 7:25 pm)