MACD Bollinger Band Indicator Watchlist for ThinkorSwim?

HDP

New member
If you could help me creating a watchlist column by using the Macd BB Indicator for tos. I would like to get the last dot to display a numerical value and display the color of the dot into a watchlist. but it has to match as close to the number on the right side of the indicator. thanks I wish I had your skill to make indicators.
 

RobertPayne

Member
RobertPayne, if you could help me creating a watchlist column by using the Macd BB Indicator for tos. I would like to get the last dot to display a numerical value and display the color of the dot into a watchlist. but it has to match as close to the number on the right side of the indicator. thanks I wish I had your skill to make indicators.

If by "help me create" you mean, "Robert, would you write me a watchlist indicator?", the answer is no. However, if what you mean is, "Robert, I have been trying to write this myself and am stuck. I need help figuring something out.", then post your code and ask your question so that I can point you in the right direction.
 

HDP

New member
Here is what I tried but I cant get the numerical value to match up with the with the lower graph number on the rightside of the indicator. thanks

Code:
# BB_MACD Bollinger Band Indicator Watchlist

input MACD_FastLength = 12;
input MACD_SlowLength = 26;
input Length = 10;
Input Std_Dev = 1.0;

rec BB_MACD = reference MACD(fastlength = MACD_FastLength, slowlength = MACD_SlowLength, MACDlength = Length);
def avg = ExpAverage(BB_MACD, Length);
def sdev = stdev(data = BB_MACD, length = Length);
#def Lower_Band = avg - Std_Dev * sdev;
#def Upper_Band = avg + Std_Dev * sdev;

plot bbmacd = BB_MACD;
def upperband = avg + Std_Dev * sdev;
def lowerband = avg - Std_Dev * sdev;
###################################### added 09032019
BBMACD.assignValueColor(if BB_MACD > upperband then color.green else if BB_MACD < LowerBand then color.red else color.red);
#BBMACD.assignValueColor(if ( BB_MACD[1]> 0.00) then color.Green else if ( BB_MACD[1] < 0.00) then color.RED else color.RED);
input Type = PriceType.LAST;
def Lastprice =(close(priceType = Type));
assignBackgroundColor(if lastprice then color.black else color.black);#added 70419
def CurrentBar = (if !isNaN(close) and isNaN(close[-1])
then barNumber()
                 else double.nan); #added 090419

def LastBar = if isNaN(close[-1]) and !isNaN(close) then barNumber() else LastBar[1]; #added 100419
def priceLine = if isNan(close[-1]) and !isNAN(close) then close else priceLine[1];#added 100419
input Dec_Places = numberformat.TWO_DECIMAL_PLACES;#added 100419
 

RobertPayne

Member
@HDP

I pasted your script into the watchlist column and it worked perfectly. The only change I made was to remove the excess code that had nothing to do with calculating bbmacd.

I believe the problem may be that you didn't match the time frame of your chart to the watchlist. Make certain that both match. Also, either check or uncheck the "extended session" box as necessary.



 

Sneaky_Swings

New member
VIP
@HDP

I pasted your script into the watchlist column and it worked perfectly. The only change I made was to remove the excess code that had nothing to do with calculating bbmacd.

I believe the problem may be that you didn't match the time frame of your chart to the watchlist. Make certain that both match. Also, either check or uncheck the "extended session" box as necessary.



What is your lower indicator in this example?
 

BenTen

Administrative
Staff
VIP
@Sneaky_Swings Same code posted in message #3:

Code:
declare lower;

# BB_MACD Bollinger Band Indicator Watchlist

input MACD_FastLength = 12;
input MACD_SlowLength = 26;
input Length = 10;
Input Std_Dev = 1.0;

rec BB_MACD = reference MACD(fastlength = MACD_FastLength, slowlength = MACD_SlowLength, MACDlength = Length);
def avg = ExpAverage(BB_MACD, Length);
def sdev = stdev(data = BB_MACD, length = Length);
#def Lower_Band = avg - Std_Dev * sdev;
#def Upper_Band = avg + Std_Dev * sdev;

plot bbmacd = BB_MACD;
def upperband = avg + Std_Dev * sdev;
def lowerband = avg - Std_Dev * sdev;
###################################### added 09032019
BBMACD.assignValueColor(if BB_MACD > upperband then color.green else if BB_MACD < LowerBand then color.red else color.red);
#BBMACD.assignValueColor(if ( BB_MACD[1]> 0.00) then color.Green else if ( BB_MACD[1] < 0.00) then color.RED else color.RED);
input Type = PriceType.LAST;
def Lastprice =(close(priceType = Type));
assignBackgroundColor(if lastprice then color.black else color.black);#added 70419
def CurrentBar = (if !isNaN(close) and isNaN(close[-1])
then barNumber()
                 else double.nan); #added 090419

def LastBar = if isNaN(close[-1]) and !isNaN(close) then barNumber() else LastBar[1]; #added 100419
def priceLine = if isNan(close[-1]) and !isNAN(close) then close else priceLine[1];#added 100419
input Dec_Places = numberformat.TWO_DECIMAL_PLACES;#added 100419
 

s1111

Member
Hey, guys quick question. I plug this script on a watchlist to match macd BB lower. Using macd BB on a 10 minute time, I wanted to be able to see if the white dot is above the upper band and on top of the green middle like which is 0. I don't know anything about coding but I did input macdlenght=5; cause that's the only thing I saw on macd BB codes.
Here is my watchlist. Please let me know if I should change anything. Thank you
watchlist
https://tos.mx/ZhCr0fz

Macd BB is set to 12 , on a 10 minute chart like he suggested. https://usethinkscript.com/threads/...s-bb-indicator-for-thinkorswim.287/post-43308

https://tos.mx/TTPHr8I
 

Similar threads

Top