I see what you mean about the bubble blocking a lot. I changed the divergence to squares with a light color. Looks great.Happy to help.
I see what you mean about the bubble blocking a lot. I changed the divergence to squares with a light color. Looks great.Happy to help.
I see what you mean about the bubble blocking a lot. I changed the divergence to squares with a light color. Looks great.
If it works best for your trading style. Then great. But you should always have a clear view of the candles..I see what you mean about the bubble blocking a lot. I changed the divergence to squares with a light color. Looks great.
Hi and thank you for your hard work on this! Is there anyway to have options to pick a different combinations of the MA's? For example if I just wanted to choose say the TEMA, DEMA and EMA as a Mega Moving Avg's (MMA) and exclude the others or visa versa? Also can this be used for a scan too? Thank you.Mega Moving Average version 1.3(Updated!)
The divergence feature is now updated and working on the hourly chart as intended. Also, two new additional features added! Remember to not solely rely on an indicator or indicators and do your own " due diligence" before making trading decisions. Stay informed with a news feed and other resources, study the charts, and draw your supply and demand levels. in other words. Check below for a detailed summary of the 1.3 version. Stay informed! Hope you enjoy and happy trading!
#Mega Moving Average version 1.3 update created by Trader4TOS 06-28-2023
#"Mega Moving Average version 1.3," has the following new features and updates:
#Multiple Moving Averages: It combines different types of moving averages such as DEMA, TEMA, SMA, and additional custom lengths into one indicator.(version1.2)
#Combined Moving Average: The indicator calculates the average value of all the moving averages to create a single combined moving average line.(version1.2)
#On Balance Volume (OBV): The indicator incorporates the calculation of OBV, which tracks the cumulative volume based on changes in closing price. It helps identify buying and selling pressure.
#Color Change Condition: The indicator includes a color change condition based on volume exceeding a certain threshold compared to its average volume.(version1.2)
#Color-Coded Indicator: The combined moving average is plotted as a line with different colors based on the color change condition and the relationship between the closing price and the combined moving average.(version1.2)
#Trending Market Condition: Updated!(version 1.3)Using the ATR. Determines if the market is in a trending state based on the Average True Range (ATR) value. A threshold of 0.01 is used, but you can adjust it according to your preference.
#Price and OBV Divergence: The indicator detects bullish and bearish divergences between price and OBV, highlighting potential reversal signals.(version1.2)
#Tracking Highest High and Lowest Low: Keeps track of the highest high and lowest low values over time.(version1.2)
#Price Range: Calculates the price range by subtracting the lowest low from the highest high.(version1.2)
#Divergence Alerts:updated! (version1.3) Improved accuracy and will only display on the hourly charts and further. The plot was changed a abandonedBaby small dot above, below is indicator the middle of the candle.
#Bullish Divergence Alert: Plots a dot at the low price when a bullish divergence occurs, and the market is trending, the current high is the highest high, and the price range is greater than 4.
#Bearish Divergence Alert: Plots a dot at the high price when a bearish divergence occurs, and the market is trending, the current low is the lowest low, and the price range is greater than 4.
# New Features of versions 1.3
#The Trend Continuation feature in the provided script helps identify potential continuation of an ongoing trend in the market. It focuses on three specific instruments: ES, NQ, and YM. Here's how it works:
#Enable/Disable: The script provides the option to enable or disable the Trend Continuation feature for each instrument. You can choose which instruments you want to consider for trend continuation analysis.
#Higher High and Lower Low: The script compares the current closing price of each instrument (ES, NQ, YM) with the previous high and low prices, respectively.
#Higher High: If the current closing price is higher than the previous high, it indicates that the instrument is potentially continuing an upward trend.
#Lower Low: If the current closing price is lower than the previous low, it indicates that the instrument is potentially continuing a downward trend.
#Trend Continuation Criteria: The script evaluates the higher high and lower low conditions for each instrument separately.
#ES Trend Continuation: Determines if there is a higher high or lower low in the ES instrument, based on the enableTrendContinuation and enableESTrend settings.
#NQ Trend Continuation: Determines if there is a higher high or lower low in the NQ instrument, based on the enableTrendContinuation and enableNQTrend settings.
#YM Trend Continuation: Determines if there is a higher high or lower low in the YM instrument, based on the enableTrendContinuation and enableYMTrend settings.
#Label Display: The script adds a label on the chart, labeled as "TC" (Trend Continuation). The label appears in yellow color if all the enabled instruments (ES, NQ, YM) meet the trend continuation criteria (i.e., at least one instrument has a higher high or lower low), indicating potential trend continuation. If any of the enabled instruments do not meet the trend continuation criteria, the label appears in gray color.
#The Trend Continuation feature helps you visually identify whether the current price action in the specified instruments suggests a continuation of the existing trend. It can be a useful tool to assist in trend-following strategies or to confirm the persistence of a trend before making trading decisions.
#The Trend Continuation feature in the provided script helps identify potential continuation of an ongoing trend in the market. It focuses on three specific instruments: /ES, /NQ, and /YM futures. Here's how it works:
#Enable/Disable: The script provides the option to enable or disable the Trend Continuation feature for each instrument. You can choose which instruments you want to consider for trend continuation analysis.
#Higher High and Lower Low: The script compares the current closing price of each instrument (ES, NQ, YM) with the previous high and low prices, respectively.
#Higher High: If the current closing price is higher than the previous high, it indicates that the instrument is potentially continuing an upward trend.
#Lower Low: If the current closing price is lower than the previous low, it indicates that the instrument is potentially continuing a downward trend.
#Trend Continuation Criteria: The script evaluates the higher high and lower low conditions for each instrument separately.
#ES Trend Continuation: Determines if there is a higher high or lower low in the ES instrument, based on the enableTrendContinuation and enableESTrend settings.
#NQ Trend Continuation: Determines if there is a higher high or lower low in the NQ instrument, based on the enableTrendContinuation and enableNQTrend settings.
#YM Trend Continuation: Determines if there is a higher high or lower low in the YM instrument, based on the enableTrendContinuation and enableYMTrend settings.
#Label Display: The script adds a label on the chart, labeled as "TC" (Trend Continuation). The label appears in yellow color if all the enabled instruments (ES, NQ, YM) meet the trend continuation criteria (i.e., at least one instrument has a higher high or lower low), indicating potential trend continuation. If any of the enabled instruments do not meet the trend continuation criteria, the label appears in gray color.
#The Trend Continuation feature helps you visually identify whether the current price action in the specified instruments suggests a continuation of the existing trend. It can be a useful tool to assist in trend-following strategies or to confirm the persistence of a trend before making trading decisions.
#New Feature of version 1.3
#Squeeze Levels & Activation
# It is highly recommended to use multiple charts to benefit from this feature. As you can see when all the charts (5minute,15min,30min,1hour and Daily) are synchronized (best when all charts are in sycn at level 10) and find entries for scalp on the lower time frames and swings for the higher time frames.
#Squeeze Activation: When a squeeze fires, meaning a transition from a non-squeezed state to a squeezed state(from 1 to 10 is the transition phase), the script displays the label "SqzActive" in yellow. This visually alerts you to the occurrence of a squeeze, which is often considered a potential signal for a significant price move. It can help you identify periods of increased volatility and potential trading opportunities.
#Squeeze Level: The script also displays the "SqzLevel" label, which indicates the level of squeeze. The level is represented by the value of sumSqueeze, which is the sum of squeeze values over the last 10 bars. The label shows the squeeze level in gray or orange, depending on whether there is an ongoing squeeze or not. This information helps you gauge the intensity or strength of the squeeze. Higher squeeze levels may suggest stronger potential price moves.
#By providing visual cues for squeeze activations and displaying the squeeze level, this script can help you identify potential trading opportunities during periods of increased volatility and price momentum. It enhances your ability to spot and track squeeze conditions, which are often associated with potential breakouts or significant market moves. 0.
Ruby:# DEMA input demaLength = 9; def demaValue = DEMA(close, demaLength); # TEMA input temaLength = 21; def temaValue = TEMA(close, temaLength); # SMA input smaLength = 50; def smaValue = SimpleMovingAvg(close, smaLength); # Additional lengths input maLength1 = 100; def maValue1 = SimpleMovingAvg(close, maLength1); input maLength2 = 200; def maValue2 = SimpleMovingAvg(close, maLength2); input maLength3 = 300; def maValue3 = SimpleMovingAvg(close, maLength3); # Combine moving averages into one def combinedMA = (demaValue + temaValue + smaValue + maValue1 + maValue2 + maValue3) / 6; # On Balance Volume (OBV) def obv = if close > close[1] then obv[1] + volume else if close < close[1] then obv[1] - volume else obv[1]; # Calculate price and OBV divergences def bullishDivergence = low > low[1] and obv < obv[1]; def bearishDivergence = high < high[1] and obv > obv[1]; # Color change condition def colorChangeCondition = volume >= average(volume, 20) * 2.0; # Trending market condition def atrLength = 14; def atr = MovingAverage(AverageType.WILDERS, TrueRange(high, close, low), atrLength); def trendingMarket = atr > 0.01; # Adjust the threshold according to your preference # Track highest high and lowest low def highestHigh = if high > high[1] then high else highestHigh[1]; def lowestLow = if low < low[1] then low else lowestLow[1]; # Calculate the price range def priceRange = highestHigh - lowestLow; # Plot the combined moving average plot Indicator = combinedMA; Indicator.SetDefaultColor(Color.GRAY); Indicator.SetPaintingStrategy(PaintingStrategy.LINE); Indicator.SetLineWeight(2); # Set the weight to 2 Indicator.AssignValueColor( if colorChangeCondition then Color.CYAN else if close < combinedMA then Color.DARK_RED else Color.DARK_GREEN ); # Divergence Alerts def bullishDivergenceAlert = if bullishDivergence and trendingMarket and high == highestHigh and priceRange > 4 then low else Double.NaN; def bearishDivergenceAlert = if bearishDivergence and trendingMarket and low == lowestLow and priceRange > 4 then high else Double.NaN; # Plot the divergence signals as moving lines plot BullishDivergenceLine = if bullishDivergenceAlert and trendingMarket and high == highestHigh and priceRange > 4 then low else Double.NaN; BullishDivergenceLine.SetDefaultColor(Color.DARK_GREEN); BullishDivergenceLine.SetPaintingStrategy(PaintingStrategy.LINE); BullishDivergenceLine.SetLineWeight(5); plot BearishDivergenceLine = if bearishDivergenceAlert and trendingMarket and low == lowestLow and priceRange > 4 then high else Double.NaN; BearishDivergenceLine.SetDefaultColor(Color.DARK_RED); BearishDivergenceLine.SetPaintingStrategy(PaintingStrategy.LINE); BearishDivergenceLine.SetLineWeight(5); # Trend Continuation Criteria input enableTrendContinuation = yes; input enableESTrend = yes; input enableNQTrend = yes; input enableYMTrend = yes; def esHigherHigh = enableTrendContinuation and enableESTrend and close("/ES") > high("/ES")[1]; def esLowerLow = enableTrendContinuation and enableESTrend and close("/ES") < low("/ES")[1]; def esTrendContinuation = esHigherHigh or esLowerLow; def nqHigherHigh = enableTrendContinuation and enableNQTrend and close("/NQ") > high("/NQ")[1]; def nqLowerLow = enableTrendContinuation and enableNQTrend and close("/NQ") < low("/NQ")[1]; def nqTrendContinuation = nqHigherHigh or nqLowerLow; def ymHigherHigh = enableTrendContinuation and enableYMTrend and close("/YM") > high("/YM")[1]; def ymLowerLow = enableTrendContinuation and enableYMTrend and close("/YM") < low("/YM")[1]; def ymTrendContinuation = ymHigherHigh or ymLowerLow; # Add a label for trend continuation AddLabel(yes, "TC", if esTrendContinuation and nqTrendContinuation and ymTrendContinuation then Color.YELLOW else Color.GRAY); def squeeze = if TTM_Squeeze().SqueezeAlert == 0 then 1 else 0; def sumSqueeze = Sum(squeeze, 10); def squeezeFired = if TTM_Squeeze().SqueezeAlert[1] == 0 and TTM_Squeeze().SqueezeAlert == 1 then 1 else 0; AddLabel(squeezeFired, "SqzActive", if squeezeFired then color.yellow else color.black); AddLabel(squeeze, "Level: " + sumSqueeze, if squeeze then color.gray else color.orange); AddLabel(!squeezeFired and !squeeze, " ", color.black);
Thanks. Try this one.Hi and thank you for your hard work on this! Is there anyway to have options to pick a different combinations of the MA's? For example if I just wanted to choose say the TEMA, DEMA and EMA as a Mega Moving Avg's (MMA) and exclude the others or visa versa? Also can this be used for a scan too? Thank you.
# DEMA
input demaLength = 9;
input enabledemaLength = yes;
def demaValue = DEMA(close, demaLength);
# TEMA
input temaLength = 21;
input enabletemaLength = yes;
def temaValue = TEMA(close, temaLength);
# SMA
input smaLength = 50;
input enablesmaLength = yes;
def smaValue = SimpleMovingAvg(close, smaLength);
# Additional lengths
input maLength1 = 100;
input enablemaLength1 = yes;
def maValue1 = SimpleMovingAvg(close, maLength1);
input maLength2 = 200;
input enablemaLength2 = yes;
def maValue2 = SimpleMovingAvg(close, maLength2);
input maLength3 = 300;
input enablemaLength3 = yes;
def maValue3 = SimpleMovingAvg(close, maLength3);
# Combine moving averages into one
def combinedMA = (demaValue + temaValue + smaValue + maValue1 + maValue2 + maValue3) / 6;
input enablecombineMA = yes;
# On Balance Volume (OBV)
def obv = if close > close[1] then obv[1] + volume
else if close < close[1] then obv[1] - volume
else obv[1];
input enableobv = yes;
# Calculate price and OBV divergences
def bullishDivergence = low > low[1] and obv < obv[1];
def bearishDivergence = high < high[1] and obv > obv[1];
# Color change condition
def colorChangeCondition = volume >= average(volume, 20) * 2.0;
# Trending market condition
def atrLength = 14;
def atr = MovingAverage(AverageType.WILDERS, TrueRange(high, close, low), atrLength);
def trendingMarket = atr > 0.01; # Adjust the threshold according to your preference
# Track highest high and lowest low
def highestHigh = if high > high[1] then high else highestHigh[1];
def lowestLow = if low < low[1] then low else lowestLow[1];
# Calculate the price range
def priceRange = highestHigh - lowestLow;
# Plot the combined moving average
plot Indicator = combinedMA;
Indicator.SetDefaultColor(Color.GRAY);
Indicator.SetPaintingStrategy(PaintingStrategy.LINE);
Indicator.SetLineWeight(2); # Set the weight to 2
Indicator.AssignValueColor(
if colorChangeCondition then Color.CYAN
else if close < combinedMA then Color.DARK_RED
else Color.DARK_GREEN
);
# Divergence Alerts
def bullishDivergenceAlert = if bullishDivergence and trendingMarket and high == highestHigh and priceRange > 4 then low else Double.NaN;
def bearishDivergenceAlert = if bearishDivergence and trendingMarket and low == lowestLow and priceRange > 4 then high else Double.NaN;
# Plot the divergence signals as moving lines
plot BullishDivergenceLine = if bullishDivergenceAlert and trendingMarket and high == highestHigh and priceRange > 4 then low else Double.NaN;
BullishDivergenceLine.SetDefaultColor(Color.DARK_GREEN);
BullishDivergenceLine.SetPaintingStrategy(PaintingStrategy.LINE);
BullishDivergenceLine.SetLineWeight(5);
input enableBullishDivergenceLine = yes;
plot BearishDivergenceLine = if bearishDivergenceAlert and trendingMarket and low == lowestLow and priceRange > 4 then high else Double.NaN;
BearishDivergenceLine.SetDefaultColor(Color.DARK_RED);
BearishDivergenceLine.SetPaintingStrategy(PaintingStrategy.LINE);
BearishDivergenceLine.SetLineWeight(5);
input enableDivergenceLine = yes;
# Trend Continuation Criteria
input enableTrendContinuation = yes;
input enableESTrend = yes;
input enableNQTrend = yes;
input enableYMTrend = yes;
def esHigherHigh = enableTrendContinuation and enableESTrend and close("/ES") > high("/ES")[1];
def esLowerLow = enableTrendContinuation and enableESTrend and close("/ES") < low("/ES")[1];
def esTrendContinuation = esHigherHigh or esLowerLow;
def nqHigherHigh = enableTrendContinuation and enableNQTrend and close("/NQ") > high("/NQ")[1];
def nqLowerLow = enableTrendContinuation and enableNQTrend and close("/NQ") < low("/NQ")[1];
def nqTrendContinuation = nqHigherHigh or nqLowerLow;
def ymHigherHigh = enableTrendContinuation and enableYMTrend and close("/YM") > high("/YM")[1];
def ymLowerLow = enableTrendContinuation and enableYMTrend and close("/YM") < low("/YM")[1];
def ymTrendContinuation = ymHigherHigh or ymLowerLow;
# Add a label for trend continuation
AddLabel(yes, "TC", if esTrendContinuation and nqTrendContinuation and ymTrendContinuation then Color.YELLOW else Color.GRAY);
input enableTClabel = yes;
#Squeeze levels
def squeeze = if TTM_Squeeze().SqueezeAlert == 0 then 1 else 0;
def sumSqueeze = Sum(squeeze, 10);
def squeezeFired = if TTM_Squeeze().SqueezeAlert[1] == 0 and TTM_Squeeze().SqueezeAlert == 1 then 1 else 0;
input enablesqueezelabel = yes;
AddLabel(squeezeFired, "SqzActive", if squeezeFired then color.yellow else color.black);
AddLabel(squeeze, "Level: " + sumSqueeze, if squeeze then color.gray else color.orange);
AddLabel(!squeezeFired and !squeeze, " ", color.black);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
L | A Volume Pressure Moving Average For ThinkOrSwim | Indicators | 15 | |
S | Moving Average Golden Cross - Death Cross For ThinkOrSwim | Indicators | 14 | |
D | Repaints MTF Moving Average Slope Histogram For ThinkOrSwim | Indicators | 20 | |
Stacked Moving Averages For ThinkOrSwim | Indicators | 88 | ||
All The Moving Average Ribbons for ThinkorSwim | Indicators | 16 |
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.