Energy Momentum EMA For ThinkOrSwim

justAnotherTrader

Active member
VIP
VIP Enthusiast
This is the third weapon in the AI-Trader pairing system — and it’s built different. Instead of chasing laggy signals, this tool shows you where real force is behind a move by treating volume as mass and price change as velocity. The output is raw momentum energy — smoothed, normalized, and ranked — so you can make decisions based on conviction, not just direction.

You can find the other 2 here:
1) https://usethinkscript.com/threads/eliteperformers-for-thinkorswim.20982/
2) https://usethinkscript.com/threads/next-gen-volume-momentum-oscillator-for-thinkorswim.20983


🎯 Core Mindset:
This tool isn’t here to tell you which way to trade — it tells you when energy is concentrated, when it's fading, and when the market is likely at a pivot.​

Read it like this:
🔓 Quick Rules
ZoneAction BiasMeaning
Above 75 and falling⚠ Take profits / fade extremesExhaustion — smart money likely exiting
Above 75 and rising✅ Momentum entry or ride the trendBreakout — high conviction buyers/sellers are active
Below 25 and rising🎯 Accumulation/Reload areaQuiet strength — early energy buildup
Below 25 and falling⛔ Stay out / waitNo interest — weak conviction, fakeouts likely

🎨 Color Code Reminder:
  • Green shades = energy rising while price rises (bullish power)
  • Red shades = energy rising while price falls (bearish pressure)
  • Purple = energy is high but falling — blowoff risk
  • Gray = no one cares — skip it

📊 Labels:
  • “Pivot Zone” shows when energy is in the top or bottom 25% — these are decision zones.
  • Other labels (Breakout Building, Exhaustion Risk, etc.) guide your narrative — match them with your price structure.

🧠 Strategy Tips:
  • Pair this with your structure or pattern setup — energy shows when a setup has force, not just shape.
  • Fade purple when extended, especially if it lines up with prior resistance/support or volume cliffs.
  • Look for trend continuation in green/red zones when price pulls back and energy holds strong.
  • Ignore signals in the gray unless something else is screaming at you.


iWO5JDz.png


Code:
declare lower;

# === Inputs ===
input length = 14;
input emaLength = 5;
input normalizeLength = 50;
input thresholdGood = 20;
input thresholdStrong = 60;
input thresholdExtreme = 85;

# === Core Energy Calculation ===
def pctChange = 100 * (close - close[1]) / close[1];
def pctChangeSquared = Sqr(pctChange);
def avgVolume = Average(volume, length);
def relativeVolume = if avgVolume != 0 then volume / avgVolume else 1;
def rawEnergy = relativeVolume * pctChangeSquared;
def energyEMA = ExpAverage(rawEnergy, emaLength);

# === Percentile Rank Normalization ===
def rankCount = fold i = 1 to normalizeLength + 1
    with counter = 0
    do counter + (if energyEMA > energyEMA[i] then 1 else 0);

def normalizedEnergy = 100 * rankCount / normalizeLength;

# === Context Flags ===
def energyPrev = normalizedEnergy[1];
def isRising = normalizedEnergy > energyPrev;
def isFalling = normalizedEnergy < energyPrev;
def priceUp = close > close[1];
def exhaustionRisk = normalizedEnergy >= thresholdExtreme and isFalling;

def explosiveMove = pctChangeSquared > 9 and relativeVolume < 1.2;
def convictionMove = pctChangeSquared > 4 and relativeVolume > 1.5;
def stealthAccum = pctChangeSquared < 2 and relativeVolume > 2;
def fakeoutMove = pctChangeSquared > 4 and relativeVolume < 1.2;

def crossedStrong = normalizedEnergy crosses above thresholdStrong;
def fastDecay = energyPrev - normalizedEnergy > 10;
def slowBurn = normalizedEnergy > thresholdGood and !fastDecay and isFalling;

# === Plot Normalized Energy ===
plot energy = normalizedEnergy;
energy.AssignValueColor(
    if exhaustionRisk then CreateColor(128, 0, 128)
    else if priceUp and normalizedEnergy >= thresholdExtreme then Color.DARK_GREEN
    else if priceUp and normalizedEnergy >= thresholdStrong then Color.GREEN
    else if priceUp and normalizedEnergy >= thresholdGood then Color.LIGHT_GREEN
    else if !priceUp and normalizedEnergy >= thresholdExtreme then Color.DARK_RED
    else if !priceUp and normalizedEnergy >= thresholdStrong then Color.RED
    else if !priceUp and normalizedEnergy >= thresholdGood then Color.PINK
    else Color.GRAY
);
energy.SetLineWeight(2);

# === Pivot Threshold Lines ===
plot pivotHigh = 75;
pivotHigh.SetDefaultColor(Color.LIGHT_GRAY);
pivotHigh.SetStyle(Curve.SHORT_DASH);
pivotHigh.SetLineWeight(1);

plot pivotLow = 25;
pivotLow.SetDefaultColor(Color.LIGHT_GRAY);
pivotLow.SetStyle(Curve.SHORT_DASH);
pivotLow.SetLineWeight(1);

# === Pivot Zone Label ===
def inPivotZone = normalizedEnergy > 75 or normalizedEnergy < 25;
AddLabel(inPivotZone,
    "⚠ Pivot Zone",
    if normalizedEnergy > 75 then Color.RED else Color.GREEN);

# === Main Interpretation Label ===
AddLabel(yes,
    if exhaustionRisk then "Exhaustion Risk (Potential Blowoff)"
    else if normalizedEnergy >= thresholdStrong and isRising then "Confirmed Breakout Momentum"
    else if normalizedEnergy >= thresholdGood and isRising then "Breakout Potential Building"
    else if relativeVolume > 1.5 and pctChangeSquared < 2 then "Accumulation/Distribution Zone"
    else "Quiet / Low Interest",
    if exhaustionRisk then CreateColor(128, 0, 128)
    else if normalizedEnergy >= thresholdStrong and isRising then Color.RED
    else if normalizedEnergy >= thresholdGood and isRising then Color.ORANGE
    else if relativeVolume > 1.5 and pctChangeSquared < 2 then Color.YELLOW
    else Color.DARK_GRAY
);

# === Supporting Context Labels ===
AddLabel(yes, if isRising then "Building Energy" else "Draining Energy",
    if isRising then Color.GREEN else Color.RED);

AddLabel(yes,
    if convictionMove then "Conviction Move"
    else if explosiveMove then "Explosive Move (Low Vol)"
    else if stealthAccum then "Stealth Accumulation"
    else if fakeoutMove then "Fakeout Risk"
    else "",
    if convictionMove then Color.CYAN
    else if explosiveMove then Color.YELLOW
    else if stealthAccum then Color.MAGENTA
    else if fakeoutMove then Color.LIGHT_RED
    else Color.GRAY);

AddLabel(crossedStrong, "New Energy Spike", Color.ORANGE);
AddLabel(slowBurn, "Slow Burn Energy (Possible Continuation)", Color.LIGHT_GREEN);
AddLabel(fastDecay, "Energy Cooling Fast", Color.BLUE);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
436 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top