plot 15m_EMA = MovAvgExponential(price = close(period = AggregationPeriod.FIFTEEN_MIN));
plot 15m_EMA = MovAvgExponential(price = close(period = AggregationPeriod.FIFTEEN_MIN));
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
could you please provide shareable linkWhat I promised. See if that is helpful for you. I just add one for each time frame needed.
#MACD Histogram Cross
#Justin Turner
Declare Upper;
input time_frame = AggregationPeriod.DAY;
def lookback = 1;
def fastLength = 12;
def slowLength = 26;
def MACDLength = 9;
def averageType = AverageType.EXPONENTIAL;
def showBreakoutSignals = no;
def time_select = (close(period = time_frame));
def value = MovingAverage(averageType, time_select, fastLength) - MovingAverage(averageType,time_select, slowLength);
def avg = MovingAverage(averageType, Value, MACDLength);
def bull_cross = value crosses above avg;
def bear_cross = value crosses below avg;
def bull_lookback = highest(bull_cross, lookback);
def bear_lookback = highest(bear_cross, lookback);
AddLabel (yes,
if Time_Frame == aggregationPeriod.YEAR then "Yr-"
else if
Time_Frame == aggregationPeriod.QUARTER then "Qtr-"
else if
Time_Frame == aggregationPeriod.MONTH then "Mo-"
else if
Time_Frame == aggregationPeriod.WEEK then "Wk-"
else if
Time_Frame == aggregationPeriod.FOUR_DAYS then "4D-"
else if
Time_Frame == aggregationPeriod.THREE_DAYS then "3D-"
else if
Time_Frame == aggregationPeriod.TWO_DAYS then "2D-"
else if
Time_Frame == aggregationPeriod.DAY then "D-"
else if
Time_Frame == aggregationPeriod.FOUR_HOURS then "4H-"
else if
Time_Frame == aggregationPeriod.TWO_HOURS then "2H-"
else if
Time_Frame == aggregationPeriod.HOUR then "1H-"
else if
Time_Frame == aggregationPeriod.THIRTY_MIN then "30m-"
else if
Time_Frame == aggregationPeriod.TWENTY_MIN then "20m-"
else if
Time_Frame == aggregationPeriod.FIFTEEN_MIN then "15m-"
else if
Time_Frame == aggregationPeriod.TEN_MIN then "10m-"
else if
Time_Frame == aggregationPeriod.FIVE_MIN then "5m-"
else if
Time_Frame == aggregationPeriod.FOUR_MIN then "4m-"
else if
Time_Frame == aggregationPeriod.THREE_MIN then "3m-"
else if
Time_Frame == aggregationPeriod.TWO_MIN then "2m-"
else if
Time_Frame == aggregationPeriod.MIN then "1m-"
else "-",
if bull_lookback then createcolor (0,204, 0)
else if
bear_lookback then createcolor (204, 0, 0)
else if
bull_lookback within 2 bars then createcolor (0, 153, 0)
else if
bear_lookback within 2 bars then createcolor (153, 0, 0)
else
color.white);
AddLabel (yes,
if
bull_lookback then "MACD Bull X"
else if
bear_lookback then "MACD Bear X"
else if
bull_lookback within 2 bars then "MACD Bull XX"
else if bear_lookback within 2 bars then "MACD Bear XX"
else "MACD",
if bull_lookback then createcolor (0,204, 0)
else if
bear_lookback then createcolor (204, 0, 0)
else if
bull_lookback within 2 bars then createcolor (0, 153, 0)
else if
bear_lookback within 2 bars then createcolor (153, 0, 0)
else
color.white);
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
S | Add Cloud to RSI moving average crossover ? | Questions | 1 | |
S | Add Moving Average Bubble & Line | Questions | 2 | |
B | Multi Time Frame Moving Average Add on Lables | Questions | 1 | |
J | Add cloud to Moving Average Envelope | Questions | 2 | |
J | add moving averages to the index? | Questions | 1 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.