Adding two custom columns to watchlist for Average Price Movements

lzstock

New member
I am looking to add two columns to my watchlist using the Possible Daily Support and Possible Daily Resistance Values the Average Price Movement creates. I know how to add the custom items but since the script returns two values I can't seem to have one for each column. Here is the original script I am using created by Ben Ten. Anyone have any ideas? I would assume I could remove one and it would work but it isn't.

# Average Price Movements
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/eHhGyI6R-CD-Average-Daily-Range-Zones-highs-and-lows-of-the-day/

input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def dayrange = (high - low);

def r1 = dayrange[1];
def r2 = dayrange[2];
def r3 = dayrange[3];
def r4 = dayrange[4];
def r5 = dayrange[5];
def r6 = dayrange[6];
def r7 = dayrange[7];
def r8 = dayrange[8];
def r9 = dayrange[9];
def r10 = dayrange[10];

def adr_10 = (r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8 + r9 + r10) / 10;
def adr_5 = (r1 + r2 + r3 + r4 + r5) / 5;

def hl1 = (open + (adr_10 / 2));
def ll1 = (open - (adr_10 / 2));
def hl2 = (open + (adr_5 / 2));
def ll2 = (open - (adr_5 / 2));

def h1 = hl1;
def l1 = ll1;
def h2 = hl2;
def l2 = ll2;

AddCloud(h1, h2, Color.RED, Color.RED);
AddCloud(l1, l2, Color.GREEN, Color.GREEN);

#h1.SetDefaultColor(Color.dark_red);
#h2.SetDefaultColor(Color.DARK_RED);
#l1.SetDefaultColor(Color.dark_green);
#l2.SetDefaultColor(Color.dark_green);

#Edited By Playstation 23.05.2020
#You can set whether to show the bubbles. Change or add the h1,h2,l1,l2 values to your preference.

input showBubble = yes;
def SR = showBubble and !IsNaN(close) and IsNaN(close [-1] ) && HighestAll(BarNumber());

#This will show the price at the support and resistance levels.
AddChartBubble(SR,h2,Concat("R: ",Round(h2)),Color.RED);
AddChartBubble(SR,l2,Concat("S: ",Round(l2)),Color.GREEN);

#Swap hashtags if you want just the Resistance/Support words.
AddChartBubble(SR, h2, "POSSIBLE SELL AT DAILY RESISTANCE", Color.RED);
AddChartBubble(SR, l2, "POSSIBLE BUY AT DAILY SUPPORT", Color.GREEN);
 

rad14733

Moderator
Staff member
VIP
@lzstock You would need to modify the script to utilize either a plot or AddLabel() instead of AddChartBubble() based on the same conditions... If you use plot you can then simply reference the Study's plot that you want for your Custom Watchlist Column...
 

lzstock

New member
Thanks. When I change the line to AddLabel it looks like this

AddLabel(SR,h2,Concat("R: ",Round(h2)),Color.RED);

It generates this for an error
3 params expected but 4 found while calling addlabel at 50:1
Expected class com.devexperts.tos.thinkscript.data.CustomColor at 50:1

Any idea?
 

Similar threads

Top