MACD Bollinger Band Indicator Watchlist for ThinkorSwim?

H

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

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.
 
H

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

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.



 
S

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

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
 
Thread starter Similar threads Forum Replies Date
BenTen MACD with Bollinger Bands (BB) Indicator for ThinkorSwim Indicators 10
bspratt22 MACD and Stochastic with 3/8 ema Questions 6
E Positive Momentum Divergence on MACD Questions 3
J MACD alert question Questions 5
I MACD scan question Questions 3

Similar threads

Top