Market context & regimeAdvanced#relative-strength#weekly-review#python

Track group and theme rotation with relative-strength ranks you compute

Once a week an agent ranks groups and themes by relative strength over a fixed universe you define, and lists new entrants to your top 20 strictly as one background input for your independent research, never to allocate capital.

How it works

  1. Define your universe and your group or theme mapping once, and keep it fixed.
  2. Run a Python script that reads the fixed, versioned universe and group or theme map plus adjusted closes from a retail public source you already store (a saved CSV or free end-of-day file, not a broker order feed), computes each group's relative strength over your chosen look-back periods, and writes {{group_rs_csv}} with columns group_id, asof_date, lookback, rs_value, rank.
  3. Give the agent {{group_rs_csv}}, {{method_file}}, and {{prior_week_top20}}; it ranks groups and lists new entrants to and exits from your top 20.
  4. Confirm the output shows the ranking method and the universe version at the top.
  5. The agent shows the ranking as a draft and a diff against last week's entry; you confirm before it is appended to your own journal.
  6. Save this week's top 20 as next week's {{prior_week_top20}}.

Copy-paste prompt

Rank groups from {{group_rs_csv}} (computed by script) using the method in {{method_file}}, with {{prior_week_top20}} as the prior week's list.
1. Show the universe version and method first.
2. Display only the rank column already in {{group_rs_csv}}; do not recompute relative strength.
3. List this week's top 20, then new entrants and exits since last week, solely by comparing that list to {{prior_week_top20}}.
4. If the prior file or the rank column is missing, say so and stop; do not invent last week's ranks.
5. Do not name individual instruments, do not suggest positions, do not imply any allocation or research focus, and state explicitly that this is only one neutral data point for your own separate analysis of individual securities.

Guardrails

  • Consistent universe definition, versioned.
  • Rankings are for your own research only, are not published, and must not be used to tilt portfolio exposure, filter watchlists, or decide which securities to analyze.
  • Method shown with the output.
  • Any deviation from the exact prompt voids the process.
  • Dry-run first: the agent shows the draft journal entry and a diff, and writes only after you confirm.

What can go wrong

Changing the universe or the group mapping between weeks creates fake "rotation". Freeze both, and version them when you must change. The LLM can also misinterpret CSV columns or invent transitions if the script output drifts; always cross-check raw numbers manually. RS rotation has well-documented regime and parameter fragility not solved by weekly automation.

Why it helps

Leadership tends to cluster in groups and themes. A consistent weekly ranking shows shifts early without anyone's opinion in the loop.

Source and references

Original write-up by Agents for Traders. Background reading is linked below.

Spotted an error, or want your post removed? Email hello@agentsfortraders.com.

Educational content only. Not investment advice or a personal recommendation. No tickers, signals or trade alerts. Trading involves risk of loss.

Conteúdo exclusivamente educativo. Não constitui aconselhamento nem recomendação de investimento. Sem tickers, sinais ou alertas de negociação. Negociar envolve risco de perda.

Related use cases