diff --git a/backend/routers/patterns.py b/backend/routers/patterns.py
index c06110f..7915cf8 100644
--- a/backend/routers/patterns.py
+++ b/backend/routers/patterns.py
@@ -61,6 +61,18 @@ def update_pattern(pat_id: str, req: PatternRequest):
return {"id": pat_id, "status": "updated"}
+@router.delete("/purge-all")
+def purge_all_patterns():
+ """Delete ALL custom/backtested patterns from the pattern library."""
+ from services.database import get_conn
+ conn = get_conn()
+ conn.execute("DELETE FROM custom_patterns WHERE source != 'builtin'")
+ n = conn.total_changes
+ conn.commit()
+ conn.close()
+ return {"deleted": n}
+
+
@router.delete("/custom/{pat_id}")
def delete_pattern(pat_id: str):
delete_custom_pattern(pat_id)
diff --git a/frontend/src/pages/Config.tsx b/frontend/src/pages/Config.tsx
index 9504a60..81b28e2 100644
--- a/frontend/src/pages/Config.tsx
+++ b/frontend/src/pages/Config.tsx
@@ -1629,15 +1629,23 @@ function DataManagementCard() {
- Note: Custom patterns, risk profiles, config, API keys, and the Knowledge Base are managed from their respective sections and are not affected by the purges above. + Note: Trade Ideas are computed live from the Pattern Library — they have no separate table. Risk profiles, config, API keys, and the Knowledge Base are managed from their respective sections.