
Institutional PSX Trading System Upgrade — Implementation Report
11/17/2026
System Name: PSX Signal Intelligence (Institutional Edition)
Target Exchange: Pakistan Stock Exchange (PSX / KSE-100)
Execution Mandate: Manual Institutional Broker Dispatch (Standard Capital Securities / SCS Trade)
Verification Status: 100% Passed (Unit Tests, API Endpoints, Static Next.js Pre-rendering)
Executive Summary
PSX Signal Intelligence has been transformed from a retail screener into a multi-tiered institutional trading platform tailored specifically for the microstructure, regulatory rules, and execution realities of the Pakistan Stock Exchange.
All four planned phases have been engineered, integrated into the live backend engine and frontend terminal, and verified:
Phase 1: PSX Market Microstructure & Circuit-Lock Protection + Regulatory Defaulter & Shariah Shield
Phase 2: Sector Rotation Matrix (RRG 4-Quadrant Framework) & KSE-100 Macro Regime Filter
Phase 3: Institutional Order Bracket Simulator & Volume-Weighted Slippage Model (with official statutory taxes)
Phase 4: Brokerage Execution Fast-Order Ticket (SCSTrade Single-Paste Box & FIX 4.2 Protocol String)
Detailed Architecture & Implementation per Phase
Phase 1: PSX Microstructure & Regulatory Defense Shield
PSX Circuit Breaker Limits (±7.5%\pm 7.5\%±7.5% or PKR 1.00 Rule):
Dynamically calculates upper and lower price bands from prior session LDCP (LDCP±max(LDCP×0.075,1.00)LDCP \pm \max(LDCP \times 0.075, 1.00)LDCP±max(LDCP×0.075,1.00)).
Upper Circuit Lock detection (
LOCKED_UPPER): When traded price reaches UpperCap−0.02UpperCap - 0.02UpperCap−0.02, ask liquidity drops to 0. The engine strictly suppressesBUY/STRONG_BUYsignals toWATCH, capping opportunity score at ≤45\le 45≤45 with clear institutional notice: "Upper Circuit Locked (Ask 0) — Unfillable".Proximity Warning (
CAP_DANGER): When price is within <1.2%<1.2\%<1.2% of the upper cap, breakout chasing is penalized and routed toWAITto prevent retail tops.
Regulatory Defaulters & Non-Compliant Shield:
Segregates stocks under PSX Rule Book Chapter 5 (Regulation 5.11.1).
Flags
DEF/DEFAULTERandNCsymbols. Automatically demotes speculative buy candidates toWAITand suppresses unverified signals.Adds filter toggles across
/scannerand/signalsto exclude defaulters with 1 click.
KMI-30 Shariah Screening:
Identifies Islamic-compliant securities according to KSE-Meezan Index criteria and exposes dedicated Shariah-only filtering.
Phase 2: Sector Rotation Matrix (RRG) & Macro Regime Filter
Backend Analytics Engine (
backend/app/analytics/sector_matrix.py):Sector Rotation Matrix: Computes volume-weighted and capitalization-weighted performance for all 38 PSX sectors, tracking turnover, advances/declines, and Relative Strength (RS) versus the KSE-100 benchmark.
Relative Rotation Graph (RRG) 4-Quadrant Mapping:
LEADING: Outperforming benchmark (RS>0RS > 0RS>0, positive change). Institutional momentum drivers.
IMPROVING: Underperforming benchmark (RS≤0RS \le 0RS≤0), but absolute change is positive. Early accumulation zone.
WEAKENING: Positive relative strength (RS>0RS > 0RS>0), but momentum is declining. Exhaustion risk.
LAGGING: Underperforming benchmark (RS≤0RS \le 0RS≤0, negative change). Drag on liquidity.
KSE-100 Macro Market Regime Filter:
Evaluates broad index velocity, market turnover, and advance/decline breadth ratio.
Classifies market into 5 institutional climates:
BULL_MOMENTUM(Risk Mode:AGGRESSIVE_LONGS, Score Adj: +0+0+0)BULL_CONSOLIDATION(Risk Mode:SELECTIVE_QUALITY, Score Adj: +0+0+0)NEUTRAL_RANGE(Risk Mode:SELECTIVE_QUALITY, Score Adj: +2+2+2)CORRECTION_RISK(Risk Mode:DEFENSIVE_TIGHT_STOPS, Score Adj: +5+5+5)BEAR_TREND(Risk Mode:CAPITAL_PRESERVATION_CASH, Score Adj: +8+8+8)
Signal Confluence Integration: In
engine.py, stocks inLEADINGsectors receive +3+3+3 opportunity score bonuses, whileLAGGINGsectors suffer −4-4−4 deductions. InCORRECTION_RISKorBEAR_TREND, candidate score thresholds are raised by +5+5+5 to +8+8+8 to protect capital.
Frontend UI Components:
MacroRegimeBanner.tsx: Live banner on Dashboard (/) showing market risk mode, score adjustment, recommended institutional posture, and leading/lagging sectors.SectorRotationMatrix.tsx: 4-Quadrant RRG matrix with Shariah filter, turnover metrics, advances/declines, and top stock selection.Sector RS and quadrant badges rendered across
/scannerand/signals.
Phase 3: Institutional Order Bracket Simulator & Slippage Model
Backend Simulator (
backend/app/analytics/slippage_simulator.py):Volume-Weighted Slippage Model: Calculates market impact from order size relative to 30-day Average Daily Volume (ADV) or trade value tiers (0.05%0.05\%0.05% for large caps up to 1.20%+1.20\%+1.20%+ for illiquid stocks).
Statutory PSX Transaction Charges Breakdown:
Brokerage Commission: 0.15%0.15\%0.15% (or minimum PKR 0.03/share).
SECP Turnover Levy: 0.002%0.002\%0.002% (0.000020.000020.00002).
Capital Value Tax (CVT): 0.01%0.01\%0.01% (0.00010.00010.0001).
NCCPL Settlement Charges: PKR 0.0010.0010.001 per share (minimum PKR 5.00).
Advance Withholding Tax (WHT): 0.02%0.02\%0.02% for Active Tax Filers vs 0.04%0.04\%0.04% for Non-Filers.
Friction-Adjusted Net Metrics:
Effective entry price factoring slippage.
Total capital required (Entry + Slippage + Statutory Charges).
True Breakeven Price: Exact price required to cover entry slippage and round-trip exit fees.
Target 1 Net Profit (PKR & %) and net Risk-to-Reward ratio after all frictional costs.
REST API Endpoint:
POST /api/journal/simulate-order
Phase 4: Brokerage Execution Fast-Order Ticket & FIX 4.2 Generator
Backend Engine (
backend/app/analytics/fix_order_formatter.py):SCS Trade Quick-Order String: Formats order for single-paste box in SCS Trade terminal:
[SYMBOL],[ACTION],[QUANTITY],[PRICE],[ORDER_TYPE],[VALIDITY],[CLIENT_CODE]
(e.g.,SYS,BUY,2500,420.50,LIMIT,DAY,SCST-PRO)FIX 4.2 Protocol String: Standard tag-delimited DMA/OMS message with modulo 256 checksum (Tag 10):
8=FIX.4.2|9=144|35=D|49=PSX_INTELLIGENCE|56=SCSTRADE_GW|34=1|52=...|11=CLORD-...|55=SYS|54=1|38=2500|40=2|44=420.50|59=0|21=1|10=178|Desktop Batch CSV: Downloadable CSV format for importing bulk orders directly into SCS Trade Desktop.
Pre-Trade Safety Checklist:
Circuit Lock Protection (verifies Ask liquidity exists).
Regulatory Counter Check (verifies normal trading counter).
Exposure Cap Check (flags orders >PKR 5,000,000> \text{PKR } 5,000,000>PKR 5,000,000).
Manual Broker Dispatch Mandate (confirming non-automated execution).
REST API Endpoints:
POST /api/journal/fast-order-ticketPOST /api/journal/export-batch-csv
Frontend UI Component:
InstitutionalExecutionModal.tsx: Available with 1 click acrossSignalDetailModal.tsx,/risk-management, and/trade-journal.