Jump to content

Component:Setup Quality Detection

From PlusEV Wiki Page
Revision as of 21:02, 10 January 2026 by 152.57.38.103 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Setup Quality Detection

[edit]

Purpose

[edit]

"How good is this setup? Is it worth trading? Risk:Reward"

This component scores every potential trade from 0-100 and assigns a grade (A+ to F). Higher grades get larger position sizes. The scoring uses a 5-factor weighted system with penalties and bonuses.


Trading Market Principle

[edit]

"Not all setups are created equal. Grade them, position size them accordingly."

  • A+ setup = everything aligned, maximum conviction → 2 lots
  • Poor setup = missing key factors → 1 lot or skip
  • Penalties protect capital → creeper, ma_struggle, wrong phase = reduce score
  • Bonuses reward quality → railroad, clean entry, near key level = boost score
  • A+ requires ALL criteria → one missing = capped at 79 (no A+)

5-Factor Weighted Scoring

[edit]

Every setup is scored across 5 factors, each with a specific weight:

Factor Weight What It Measures Score Source
Timeframe Alignment 30% Are all timeframes pointing same direction? MTF alignment_score × 100
Trend Strength 20% Is the trend strong with no adverse conditions? 100 - penalties + bonuses
Entry Quality 15% Are we entering at a good spot? Near MA, clean entry bonuses
Key Level Proximity 20% Are we near support/resistance/institutional levels? Near key level check
Risk/Reward 15% Is the R:R ratio acceptable? Lookup table

Formula:

Weighted_Score = (TF × 0.30) + (Trend × 0.20) + (Entry × 0.15) + (KeyLevel × 0.20) + (RR × 0.15)

Factor Calculations

[edit]

Factor 1: Timeframe Alignment (30%)

[edit]
Input:  TimeframeAnalysisResult.alignment_score (0-1)
Output: Score 0-100

score = alignment_score × 100

Factor 2: Trend Strength (20%)

[edit]

Starts at 100, then applies penalties and bonuses:

trend_score = 100

// PENALTIES (subtracted)
IF is_creeper_move:        trend_score -= 50
IF price_ma_struggle:      trend_score -= 30
IF NOT has_two_day_trend:  trend_score -= 30
IF trend_phase != MIDDLE:  trend_score -= 25

// BONUSES (added)
IF is_railroad_trend:      trend_score += 15

RETURN clamp(trend_score, 0, 100)

Factor 3: Entry Quality (15%)

[edit]
entry_score = 100

IF near_key_level:    entry_score += 10   // Key level bonus
IF NOT near_ma:       entry_score -= 40   // MA distance penalty
IF clean_entry:       entry_score += 10   // Clean entry bonus

RETURN clamp(entry_score, 0, 100)

Factor 4: Key Level Proximity (20%)

[edit]

Major Institutional Levels Only

Only Institutional levels are used for near_key_level detection:

Level Description
PDH/PDL Prior Day High/Low - "ceilings & floors", major makret memory points
200 MA Zone 25pt buffer - MAs are zones/cushions, not skinny lines
Weekly H/L Prior Week High/Low - institutional reference levels

Excluded (too noisy): Swing levels, 21 MA, Yesterday's Close, HH/HL/LH/LL structure

level_score = 100

# TICKET-25: near_key_level uses major levels only (PDH/PDL, 200 MA zone, Weekly H/L)
IF NOT near_key_level AND NOT near_ma:
    level_score -= 50   // Major penalty

RETURN clamp(level_score, 0, 100)

Factor 5: Risk/Reward (15%)

[edit]

Uses lookup table:

R:R Ratio Score Quality
< 1.0 0 Unacceptable
1.0 - 1.5 40 Poor
1.5 - 2.0 70 Acceptable
2.0 - 3.0 90 Good
≥ 3.0 100 Excellent

Penalties & Bonuses

[edit]
Type Condition Value Factor Affected
Penalty Creeper move detected -50 Trend Strength
Penalty Price struggling near MA -30 Trend Strength
Penalty No two-day trend -30 Trend Strength
Penalty Phase != MIDDLE -25 Trend Strength
Penalty Not near MA -40 Entry Quality
Penalty Not near key level or MA -50 Key Level Proximity
Bonus Railroad trend detected +15 Trend Strength
Bonus Near key level +10 Entry Quality
Bonus Clean entry +10 Entry Quality

Institutional Fight Multiplier

[edit]

If institutional fight is in progress, apply 30% penalty:

IF institutional_fight_in_progress:
    final_score = weighted_score × 0.70

This reduces all scores by 30% when big players are battling.


A+ Criteria Enforcement

[edit]

To get A+ grade, setup must meet ALL three criteria:

Criteria Requirement
All Timeframes Aligned timeframe_analysis.aligned = True
Entry Near MA entry_data.near_ma = True
Two-Day Trend Present market_state.has_two_day_trend = True

If ANY criteria missing: Score is capped at 79 (maximum A grade, no A+)


Grade Thresholds

[edit]
Grade Min Score Position Size Risk % Auto-Trade
A+ 90 2 lots 1.5% Yes
A 80 1 lot 1.2% Yes
B 70 1 lot 1.0% No
C 60 1 lot 0.8% No
D 50 1 lot 0.5% No
F <50 1 lot 0.3% No

Example Calculation

[edit]

Scenario: MTF aligned at 85%, railroad trend, near MA, R:R = 2.5, no two-day trend

STEP 1: Calculate Factor Scores
─────────────────────────────────────────────────
Factor 1 (TF Alignment):  85% × 100 = 85.0
Factor 2 (Trend):         100 - 30 (no 2-day) + 15 (railroad) = 85.0
Factor 3 (Entry):         100 + 10 (near MA) = 110 → capped at 100.0
Factor 4 (Key Level):     100.0 (near MA counts)
Factor 5 (R:R):           90.0 (R:R 2.5 is in [2.0-3.0) range)

STEP 2: Apply Weights
─────────────────────────────────────────────────
Weighted = (85×0.30) + (85×0.20) + (100×0.15) + (100×0.20) + (90×0.15)
         = 25.5 + 17.0 + 15.0 + 20.0 + 13.5
         = 91.0

STEP 3: A+ Enforcement
─────────────────────────────────────────────────
Missing two-day trend → Cap at 79.0

FINAL: Score = 79.0, Grade = A

Configuration

[edit]
Parameter Default Description
timeframe_alignment_weight 0.30 30% weight
trend_strength_weight 0.20 20% weight
entry_technique_weight 0.15 15% weight
key_level_proximity_weight 0.20 20% weight
risk_reward_weight 0.15 15% weight
creeper_move_penalty -50 Creeper penalty
ma_struggle_penalty -30 MA struggle penalty
two_day_trend_penalty -30 Missing 2-day penalty
phase_mismatch_penalty -25 Wrong phase penalty
institutional_fight_multiplier 0.70 30% reduction

Output

[edit]

SetupQualityResult:

Field Type Description
grade Enum A_PLUS, A, B, C, D, F
score float Final score 0-100
factor_scores Dict Individual factor scores
position_size int 1 or 2 lots
risk_percent float Risk % for this grade
can_auto_trade bool Only A+ and A
penalties_applied List Which penalties were applied
a_plus_criteria_met bool All 3 criteria met?

Dependencies

[edit]

Upstream:

Downstream: