BBMA Trend & MomentumBBMA Trend & Momentum
The BBMA structure read as one running sequence rather than a handful of separate signals.
Most tools built on Bollinger Bands and moving averages draw the lines and leave the reading to
you. This one keeps a memory. It knows that momentum came first, that a reversal candle followed it, that the pullback target has already been reached, and it will not report the next step until the ones before it have happened. Each label on the chart is a position in that sequence, not an isolated condition that happened to be true.
Two of those steps are level touches rather than candle patterns, and they are treated
differently from the rest. That distinction is explained below and it matters.
THE LINES
Four families are drawn. Seven individual lines carry every rule in the script.
Bollinger Bands SMA 20 with deviation 2, giving Upper, Mid and Lower
LW MA on the HIGH weighted averages of the candle HIGH, drawn in the upper colour
LW MA on the LOW weighted averages of the candle LOW, drawn in the lower colour
EMA 50 on Close, drawn as a slower reference
The High averages sit above price and the Low averages below it, because of what they are
averaging. That is what forms the two bands the price runs between.
The seven lines every rule is written against are the three Bollinger Bands and the 5 and 10
period LW MAs on each side. Those four averages are drawn SOLID. Periods 6 to 9 are drawn DASHED, exist only to show the shape of the band, and sit on their own switch so you can take them off and see for yourself that nothing is calculated from them. Within each band the 5 sits nearer to price and the 10 further out.
The EMA 50 is drawn and nothing is measured from it either. It is there as background context for your own reading, and it can be switched off without changing a single label.
THE SEQUENCE
Upper and Lower name the band an event belongs to. Every rule below has an exact mirror on the other side, so only the Upper form is spelled out.
CSM - Candlestick Momentum
LW MA 5 High is above the Upper BB, and the candle CLOSES above LW MA 5 High.
The close is therefore beyond the outer band as well, without needing to be tested for it.
EX - Extreme
A CSM has already happened and its Extreme has not been taken yet. LW MA 5 High is still
outside the Upper BB, but a candle now CLOSES back below it. That candle must not reach down to LW MA 5 Low, LW MA 10 Low, or the Mid BB. Touching any one of the three disqualifies it. Exactly one Extreme belongs to one CSM. For another Extreme, a new CSM has to come first.
MTP - Mandatory Take Profit
After an Extreme, the first time price reaches LW MA 5 Low or LW MA 10 Low.
If a new CSM or a new MTM arrives before that touch, the MTP is cancelled and a fresh Extreme
has to form before it can be looked for again.
MLV - Market Volume Lost
After the MTP has been reached, a candle rises to the Upper BB but cannot CLOSE beyond it, and closes at or above the Mid BB. The band was tested and refused.
CSD - Candlestick Direction
A candle that opens on one side of the Mid BB and CLOSES through it, and in the same candle
closes beyond BOTH LW MA 5 and LW MA 10 on the side it broke into. An Upper CSD breaks upward through the Mid BB and both High averages; a Lower CSD breaks downward through the Mid BB and both Low averages. CSD is named by the direction it broke, not by which cycle it interrupted.
MTM - Momentum Push
After a CSM, price falls back below the Upper BB without ever CLOSING below the Mid BB, then
closes above the Upper BB again. That renewed push is the MTM candle. It is not itself a CSM,
which is what separates the two - and because it is not a CSM, it does not open the door to a
new Extreme either. It only clears whatever the previous CSM had left waiting.
RE - Re-Entry
The touch that follows CSM, MTM or CSD. An upper-band sequence looks for LW MA 5 Low or LW MA 10 Low; a lower-band sequence looks for LW MA 5 High or LW MA 10 High. Three kinds are marked separately, because they arrive from three different places:
CSM RE a pullback that was followed by a full CSM
MTM RE a pullback that was followed by an MTM push
CSD RE the pullback after a CSD
WHAT IS READ WHEN
This is the part worth being precise about.
CSM, EX, MLV, CSD and MTM are structure. They are decided on the CLOSE of a candle, and once
decided they never change.
MTP and RE are not patterns, they are level touches. A touch happens at the moment price reaches the level, not when the candle finishes, so both are read on the RUNNING candle. Waiting for the close would report the touch after the level had already been passed, which would describe something other than what happened.
When a running-candle label and a closing label land on the same bar, the running one is
removed and its text is folded into the closing label, so the two never sit on top of each other.
WHAT MAKES THIS DIFFERENT
1. It is a sequence, not a checklist.
An Extreme is not reported unless a CSM came first. An MTP is not looked for until an Extreme has been confirmed, and an MLV not until the MTP has been reached. The same candle shape means different things depending on what came before it, and the script keeps track of that.
2. A step can be cancelled, not only completed.
If momentum resumes with a new CSM or an MTM while an MTP is still waiting for its touch, that MTP is dropped. The market changed its mind, so the sequence restarts rather than reporting a target that no longer belongs to anything.
3. One Extreme per CSM.
An Extreme is the answer to a particular CSM, so it is reported once and then that CSM is spent.
Price can keep closing back inside the band for the next ten candles and none of them will be
called an Extreme. A new CSM has to arrive first. An MTM push does not substitute for one.
4. The Extreme test is deliberately narrow.
Closing back inside the band is not enough. The candle also has to stay clear of the opposite LW
MA 5 and 10 and of the Mid BB. A candle that reaches any of them has done more than fail at the edge, and it is not reported as an Extreme.
5. CSD is named by what it did.
A downward break through the Mid BB and both Low averages is a Lower CSD, wherever it happens to appear. Naming it after the cycle it interrupted would put the wrong word on the chart.
6. Touches are read as touches.
The two events that are levels rather than candle patterns are handled as levels, on the running candle, and the script says so plainly rather than pretending everything is close-based.
READING THE CHART
Each event prints a small label at the candle it belongs to. Upper-band events sit above the
candle, lower-band events below it, and where several land on the same candle they are stacked into one label instead of overlapping.
CSM momentum push beyond the outer band
MTM renewed push after a pullback
EX the reversal candle
MTP first touch of the opposite LW MA 5/10 after an Extreme
MLV the outer band tested and refused
CSD Mid BB and both same-side LW MAs broken together
CSM RE / MTM RE / CSD RE the re-entry touch, named after what preceded it
SETTINGS
Lines
- BB Period and BB Deviations for the Bollinger Bands.
- BB Shift: moves the drawn bands only. The values every rule is measured against are not
moved.
- LW MA 5 to 10 Low and LW MA 5 to 10 High: the twelve weighted average periods. Only 5 and 10 are used by any rule.
- EMA Period.
Pattern Types
- A switch for each of the seven: CSM, MTM, EX, MTP, MLV, CSD and RE.
Line Style
- Show LW MAs: the 5 and 10 period averages, the ones every rule is measured against.
- Show LW MA 6-9 Band: the four decorative periods on each side, on their own switch. Turning
them off is the quickest way to check the claim above - the chart gets simpler and not a single
label moves.
- Show or hide the Bollinger Bands and the EMA.
- Colours for the Bollinger Bands, the LW MA High band, the LW MA Low band and the EMA.
Labels
- Label Size.
ALERTS
Fourteen alert conditions, one for each event on each side:
CSM Upper / CSM Lower
MTM Upper / MTM Lower
EX Upper / EX Lower
MTP Upper / MTP Lower
MLV Upper / MLV Lower
CSD Upper / CSD Lower
Re-Entry Upper / Re-Entry Lower
The structural ones fire once per bar close. MTP and Re-Entry fire once per bar, because they are touches and are read on the running candle.
The same events are also sent through the alert function, so the "Any alert() function call"
alert type can deliver all of them through a single alert. Those messages name the exact
Re-Entry kind - CSM, MTM or CSD - which a fixed alert condition cannot.
REPAINTING
This script does not repaint.
CSM, MTM, EX, MLV and CSD are structure. They are evaluated only after a candle has fully closed and the state memory they drive is updated only on closes, so price moving inside an open candle cannot change the sequence.
MTP and Re-Entry are read on the running candle, and that deserves a straight answer rather than a disclaimer, because a label that can appear mid-candle usually can vanish mid-candle too. Here it cannot, and the reason is in the arithmetic of the level being watched.
A weighted average of the LOW gives the candle still forming a weight of one third at length 5,
and about one fifth at length 10. The running low of that candle falls three to five times faster
than the average it is being compared against. So the moment the low reaches the average, the gap between them can only keep closing. It can never reopen inside that candle. The high side is the exact mirror.
Which means:
- Once an MTP or Re-Entry label is drawn, it stays. It cannot un-touch before the candle closes.
- Reloading the chart gives the same result, because a closed candle is evaluated once using its
final low and high, and those are the most extreme values the candle ever had.
- The only thing that changes at the close is presentation: a running-candle label is folded into
the closing label for that bar so the two do not sit on top of each other. The event itself is
not re-decided.
When you create an alert, TradingView may show a caution banner saying the indicator can repaint.
That banner appears automatically for any script that uses the built in bar state variables, no
matter how they are used, because the platform cannot check the intent behind them. For the
structural alerts, choosing "Once Per Bar Close" is still recommended.
NOTES AND LIMITATIONS
- CSD is the strong form only: the Mid BB and BOTH same-side LW MAs have to be broken by the same candle. A Mid BB break on its own is not reported.
- An Extreme always needs a CSM before it. A reversal candle appearing without that history is
not an Extreme here, whatever it looks like.
- The 6, 7, 8 and 9 period LW MAs and the EMA 50 are drawn but never measured. Changing them, or hiding them, changes the picture and nothing else.
- BB Shift is visual only. Shifting the bands does not shift the rules.
- TradingView caps a script at 500 labels and the oldest are dropped once that cap is reached, so on a long history the earliest labels leave the chart.
- Detection is purely structural. It reports where each step of the sequence occurred and nothing more. It does not rank setups by quality, measure what happened next, or produce entries, targets or stops.
HOW TO USE IT
Read the labels in order rather than one at a time. A CSM on its own says momentum arrived. The same CSM followed by an Extreme says the move ran out of room. That Extreme followed by an MTP and then an MLV says the band was tested again and refused. Each label narrows what the previous one meant.
The two bands are the working area. Price spends most of its time between the LW MA High band and the LW MA Low band, and the Re-Entry marks are where it came back to one of them after a push.
A CSD is the point where the picture changes side. It is the only event in the set that breaks
the Mid BB and both same-side averages in one candle, and everything after it belongs to the new direction.
These are reference points, not entry signals on their own. Use them alongside your own analysis, your own entry method and proper risk management.
DISCLAIMER
This indicator is a pattern detection tool. It is not financial advice and it makes no claim
about profitability. Trading involves risk. Always apply your own analysis and risk management.
Chỉ báo






















