Magical Numbers - Time vs. Bars

whoDAT

Active member
Plus
In running a couple custom studies (that I'm under obligation to not disclose the script) -- I see periodicity and would to hear your feedback.
I've seen the same "magic numbers" in many studies and products.

For example on a 15-min chart (#bars, win rate %)
410 - 77%
460 - 82%
510 - 79%

On a 30 minute chart:
200 - 72%
230 - 80% *this has 15% more $ profit than the below 260 periods
260 - 79%

So what's so magical about 460 on a 15 min chart? or 230 on a 30 min chart?
Well - its 5 days X 23 hours worth, or exactly 1 week of trading for this FOREX product.

Even weird studies with long averages have great results.
Another study on a 15-min chart FOREX product. (with similar results on a US index).
1280 - 87%
1380 - 91% * $ won here is 20% more than the 1480 even with similar win rates.
1480 - 90%

1380 periods equals exactly 15 days of trading - exactly 3 weeks - in a 15-min chart.

Anywho.. Has anyone experienced similar results? Is this something you program into your studies? I expect some periodicity in many markets due to structural inputs and suspect we should pay more attention to these magic number of periods.
 
@whoDAT Yes, there are correlations to average lengths for charting... For example, 21 is the average number of trading days in a month (252 trading days / 12)... Other lengths are sometimes based on either Fibonacci numbers (3, 5, 8, 13, 21, 34, 55, etc), or prime numbers... I have read that some traders use numbers such as those you noted in your first post... It's all about what works for you and/or what matches your superstitions...
 
A market regime + timing engine based off the weekly and 3 week cycle engine
It tells you:
  • Who is in control (bulls vs bears)
  • Whether the market is coiled or expanding
  • When a move is likely starting

COMPONENTS​

HISTOGRAM (Green / Red bars)​

Short-term (1-week) trend strength
  • Green → bullish momentum
  • Red → bearish momentum
  • Bigger bars → stronger move
This is your execution bias

CYAN LINE​

Higher timeframe (3-week) trend
  • Above 0 → macro bullish
  • Below 0 → macro bearish
This is your direction filter

🟡 DOTS (Compression)​

Low volatility = energy building
  • Market is coiling
  • Move is coming soon
This is your setup phase

ARROWS (Expansion Trigger)​

Compression THEN expansion release
  • Marks the moment the move starts
  • Highest probability timing
This is your entry timing signal

SIMPLE HOW TO USE​

BEST TRADE (A+)​

  1. Histogram = green or red
  2. Cyan line = same direction
  3. Yellow dots appeared recently
  4. Arrow fires
Then use SMC for entry

AVOID​

  • Histogram flipping colors rapidly
  • Cyan line opposite direction
  • No compression before move
That = chop / low quality

ONE-LINE SUMMARY​

Histogram = now
Cyan line = bigger trend
Dots = energy building
Arrows = move starting

Ultra-condensed 2-rule checklist you can literally trade off in seconds:

2-RULE SYSTEM​

RULE 1 — DIRECTION (Don’t fight this)​

Trade ONLY in the direction of alignment:
  • Histogram + Cyan BOTH GREEN → LONGS ONLY
  • Histogram + Cyan BOTH RED → SHORTS ONLY
If they disagree - NO TRADE

RULE 2 — TIMING (This is the money)​

Enter ONLY when:
  • Yellow dots (compression) happened
  • AND Arrow just printed (expansion trigger)

A+ TRADE = BOTH RULES MET​

Direction aligned + Compression → Arrow
Then use your favorite entry precision tool

QUICK AVOID FILTER​

Don’t trade if:
  • No recent compression
  • Histogram flipping colors
  • Cyan line opposite
That’s chop / fake moves

5-SECOND READ​

  • Green/Green → look longs
  • Red/Red → look shorts
  • Yellow → wait
  • Arrow → go

EVEN SIMPLER- Align → Coil → Fire

Code:
# A market regime + timing engine
# WEEKLY_ENGINE_MACRO_CYCLE_ALIGNMENT
# ANTWERKS 04/17/2026
########################################################

declare lower;

#========================
# AUTO TIMEFRAME DETECTION
#========================
def agg = GetAggregationPeriod();

def is5m  = agg == AggregationPeriod.FIVE_MIN;
def is15m = agg == AggregationPeriod.FIFTEEN_MIN;
def is30m = agg == AggregationPeriod.THIRTY_MIN;

def weekLength =
    if is5m then 1380
    else if is15m then 460
    else if is30m then 230
    else 460;

def threeWeekLength = weekLength * 3;

#========================
# WEEKLY ENGINE (FAST)
#========================
def emaW = ExpAverage(close, weekLength);
def slopeW = emaW - emaW[10];

def atrW = Average(TrueRange(high, close, low), weekLength);
def normW = slopeW / atrW;

#========================
# 3-WEEK ENGINE (SLOW)
#========================
def ema3W = ExpAverage(close, threeWeekLength);
def slope3W = ema3W - ema3W[20];

def atr3W = Average(TrueRange(high, close, low), threeWeekLength);
def norm3W = slope3W / atr3W;

#========================
# STATES
#========================
def bullW = normW > 0.02;
def bearW = normW < -0.02;

def bull3W = norm3W > 0.02;
def bear3W = norm3W < -0.02;

def alignBull = bullW and bull3W;
def alignBear = bearW and bear3W;

def conflict =
    (bullW and bear3W) or
    (bearW and bull3W);

#========================
# HISTOGRAM (WEEKLY)
#========================
plot WeeklyCycle = normW;
WeeklyCycle.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
WeeklyCycle.SetLineWeight(3);

WeeklyCycle.AssignValueColor(
    if alignBull then Color.GREEN
    else if alignBear then Color.RED
    else if conflict then Color.YELLOW
    else Color.GRAY
);

#========================
# 3-WEEK OVERLAY (LINE)
#========================
def slope3 = norm3W - norm3W[5];

plot MacroCycle = norm3W;
MacroCycle.SetDefaultColor(Color.CYAN);
MacroCycle.SetLineWeight(2);
MacroCycle.AssignValueColor(
    if norm3W > 0 and slope3 > 0 then Color.GREEN
    else if norm3W > 0 and slope3 <= 0 then Color.DARK_GREEN
    else if norm3W < 0 and slope3 < 0 then Color.RED
    else if norm3W < 0 and slope3 >= 0 then Color.DARK_RED
    else Color.GRAY
);
#========================
# ZERO LINE
#========================
plot Zero = 0;
Zero.SetDefaultColor(Color.GRAY);
Zero.SetStyle(Curve.SHORT_DASH);

#========================
# LABEL ENGINE
#========================
AddLabel(yes,
    if alignBull then "FULL BULL ALIGNMENT (1W + 3W)"
    else if alignBear then "FULL BEAR ALIGNMENT (1W + 3W)"
    else if conflict then "CYCLE CONFLICT (CHOP / TRANSITION)"
    else "WEAK / NEUTRAL",
    
    if alignBull then Color.GREEN
    else if alignBear then Color.RED
    else if conflict then Color.YELLOW
    else Color.GRAY
);

#========================
# VOLATILITY COMPRESSION
#========================

input shortATRLength = 14;

# short-term volatility
def atrShort = Average(TrueRange(high, close, low), shortATRLength);

# already defined:
# atrW (weekly ATR)

def compressionRatio = atrShort / atrW;

# thresholds (tuneable)
input compressionThreshold = 0.45;
input expansionThreshold = 1.2;

def isCompression = compressionRatio < compressionThreshold;
def isExpansion = compressionRatio > expansionThreshold;
def compressZone =
    if isCompression then 0 else Double.NaN;
def compressionRelease =
    isCompression[1] and !isCompression;

plot ExpansionTrigger =
    if compressionRelease then normW else Double.NaN;

ExpansionTrigger.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ExpansionTrigger.SetDefaultColor(Color.CYAN);
ExpansionTrigger.SetLineWeight(3);

def exhaustion =
    normW > 0.08 or normW < -0.08;

AddCloud(compressZone, 0, Color.DARK_GRAY, Color.DARK_GRAY);

plot CompressionDot =
    if isCompression then normW else Double.NaN;

CompressionDot.SetPaintingStrategy(PaintingStrategy.POINTS);
CompressionDot.SetDefaultColor(Color.YELLOW);
CompressionDot.SetLineWeight(3);

plot ExpansionDot =
    if isExpansion then normW else Double.NaN;

ExpansionDot.SetPaintingStrategy(PaintingStrategy.POINTS);
ExpansionDot.SetDefaultColor(Color.CYAN);
ExpansionDot.SetLineWeight(3);

AddLabel(yes,
    if isCompression then "COMPRESSION (BUILDING ENERGY)"
    else if isExpansion then "EXPANSION (MOVE ACTIVE)"
    else "NORMAL VOL",
    
    if isCompression then Color.YELLOW
    else if isExpansion then Color.CYAN
    else Color.GRAY
);

AddLabel(exhaustion,
    if normW > 0 then "BULL EXHAUSTION"
    else "BEAR EXHAUSTION",
    Color.ORANGE
);

 
Last edited:
Funny how we rediscover "discoveries". I seem to do this regularly lol... Great minds think alike!
How long has THIS exact combination existed? (Magical Numbers - Time vs. Bars)

In this exact form? Maybe last 10–15 years (quant + retail hybrid thinking). But components individually:
  • Cycles → 100+ years
  • Volatility expansion → ~40 years
  • Multi-timeframe alignment → decades
  • Relative strength → ~20+ years
  • And now again, today!!!
 

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
658 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