I'm brand new to thinkscript, just dove into it this weekend. I'm building myself a script that places labels on my 1-min chart that turn green when certain parameters I'm looking for are met on higher time frames. I've gotten most of it to work, except my "MACD Fade" labels don't update when I change tickers. In order to get them to update, I have to make some kind of edit in the script and click "apply." The rest of them update fine, and I don't understand why the "MACD Fade" ones won't update. Any help would be appreciated.
By "MACD Fade" I mean the MACD histogram is "fading" into buying pressure, or simply, the current bar on the MACD histogram is a greater value than the previous bar.
This is the current code that I'm working with. I'm sure it's very amateur-ish, but like I said, I've just started learning it a couple days ago.
By "MACD Fade" I mean the MACD histogram is "fading" into buying pressure, or simply, the current bar on the MACD histogram is a greater value than the previous bar.
This is the current code that I'm working with. I'm sure it's very amateur-ish, but like I said, I've just started learning it a couple days ago.
Code:
##FIFTEEN MINUTE TRP SETUP
def IsUp = close(period = AggregationPeriod.FIFTEEN_MIN) > open(period = AggregationPeriod.FIFTEEN_MIN);
def IsDown = close(period = AggregationPeriod.FIFTEEN_MIN) < open(period = AggregationPeriod.FIFTEEN_MIN);
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high(period = AggregationPeriod.FIFTEEN_MIN) - low(period = AggregationPeriod.FIFTEEN_MIN), 20);
def trpfifteentrue =
IsDown[1] and
IsUp[0] and
high(period = AggregationPeriod.FIFTEEN_MIN)[1] > high(period = AggregationPeriod.FIFTEEN_MIN)[0] and
open(period = AggregationPeriod.FIFTEEN_MIN)[1] > high(period = AggregationPeriod.FIFTEEN_MIN)[0] and
open(period = AggregationPeriod.FIFTEEN_MIN)[1] > close(period = AggregationPeriod.FIFTEEN_MIN)[0] and
close(period = AggregationPeriod.FIFTEEN_MIN)[1] < close(period = AggregationPeriod.FIFTEEN_MIN)[0] and
low(period = AggregationPeriod.FIFTEEN_MIN)[1] > low(period = AggregationPeriod.FIFTEEN_MIN)[0];
AddLabel(yes, "TRP15", if trpfifteentrue then Color.GREEN else Color.RED);
##THREE MINUTE AWESOME OSCILLATOR
def AO = Average(hl2(period = AggregationPeriod.THREE_MIN), 5) - Average(hl2(period = AggregationPeriod.THREE_MIN), 34);
def Zero = 0;
def true = AO is greater than AO from 1 bars ago;
def false = AO is less than AO from 1 bars ago;
AddLabel(yes, "AO3", if true then Color.GREEN else Color.RED);
##FIVE MINUTE MACD FADE
def fastLength = 10;
def slowLength = 26;
def MACDLength = 9;
input averageType = AverageType.WILDERS;
plot Diff5 = MACD(fastLength, slowLength, MACDLength, averageType, AggregationPeriod.FIVE_MIN).Diff;
AddLabel(yes, "5MACD Fade", if Diff5 > Diff5[1] is true then Color.GREEN else Color.RED);
##THIRTY MINUTE TRP SETUP
def IsUpthirty = close(period = AggregationPeriod.THIRTY_MIN) > open(period = AggregationPeriod.THIRTY_MIN);
def IsDownthirty = close(period = AggregationPeriod.THIRTY_MIN) < open(period = AggregationPeriod.THIRTY_MIN);
def IsDojithirty = IsDoji();
def avgRangethirty = 0.05 * Average(high(period = AggregationPeriod.THIRTY_MIN) - low(period = AggregationPeriod.THIRTY_MIN), 20);
def trpthirtytrue =
IsDownthirty[1] and
IsUpthirty[0] and
high(period = AggregationPeriod.THIRTY_MIN)[1] > high(period = AggregationPeriod.THIRTY_MIN)[0] and
open(period = AggregationPeriod.THIRTY_MIN)[1] > high(period = AggregationPeriod.THIRTY_MIN)[0] and
open(period = AggregationPeriod.THIRTY_MIN)[1] > close(period = AggregationPeriod.THIRTY_MIN)[0] and
close(period = AggregationPeriod.THIRTY_MIN)[1] < close(period = AggregationPeriod.THIRTY_MIN)[0] and
low(period = AggregationPeriod.THIRTY_MIN)[1] > low(period = AggregationPeriod.THIRTY_MIN)[0];
AddLabel(yes, "TRP30", if trpthirtytrue then Color.GREEN else Color.RED);
##HOURLY 200 EMA
def length = 200;
def price = close(period = AggregationPeriod.HOUR);
def displace = 0;
def ema = ExpAverage(price[-displace], length);
def condition = close(period = AggregationPeriod.HOUR) > ema;
AddLabel(yes, "200 1hr", if condition then Color.GREEN else Color.RED);
##THREE MACD UP SIGNAL
def Valuethree = MovingAverage(averageType, close(period = AggregationPeriod.THREE_MIN), fastLength) - MovingAverage(averageType, close(period = AggregationPeriod.THREE_MIN), slowLength);
def Avgthree = MovingAverage(averageType, Valuethree, MACDLength);
def Diffthree = Valuethree - Avgthree;
def ZeroLinethree = 0;
def UpSignalthree = if Valuethree crosses above Valuethree[1] then Valuethree else Double.NaN;
AddLabel(yes, "3MACD UP", if UpSignalthree is true then Color.GREEN else Color.RED);
##FIVE MACD UP SIGNAL
def Valuefive = MovingAverage(averageType, close(period = AggregationPeriod.FIVE_MIN), fastLength) - MovingAverage(averageType, close(period = AggregationPeriod.FIVE_MIN), slowLength);
def Avgfive = MovingAverage(averageType, Valuefive, MACDLength);
def Difffive = Valuefive - Avgfive;
def ZeroLinefive = 0;
def UpSignalfive = if Valuefive crosses above Valuefive[1] then Valuefive else Double.NaN;
AddLabel(yes, "5MACD UP", if UpSignalfive is true then Color.GREEN else Color.RED);
##TEN MACD FADE
def Diff10 = MACD(fastLength, slowLength, MACDLength, averageType, AggregationPeriod.TEN_MIN);
AddLabel(yes, "10MACD Fade", if Diff10 > Diff10[1] then Color.GREEN else Color.RED);
##FIFTEEN MACD FADE
def Diff15 = MACD(fastLength, slowLength, MACDLength, averageType, AggregationPeriod.FIFTEEN_MIN);
AddLabel(yes, "15MACD Fade", if Diff15 > Diff15[1] then Color.GREEN else Color.RED);
##THIRTY MACD FADE
##TEN MACD UP SIGNAL
##FIFTEEN MACD UP SIGNAL
##THIRTY MACD UP SIGNAL
##HOURLY MACD UP SIGNAL