OPEN-SOURCE SCRIPT

Position Sizer (Share Qty)

49
  • This indicator enables fast & accurate position sizing for traders using (user defined) fixed dollar risk, eliminating the need for manual calculations and supporting disciplined risk management directly on the chart
  • Calculates precise share quantity for fixed-risk trades using the formula Shares = Risk Amount / (Current Price – Stop Price), rounded to the nearest whole share, updating in real time on every bar
  • Offers two dynamic stop-loss options: Low of Day (LoD) — tracked only during Regular Trading Hours (9:30 AM – 4:00 PM ET) with automatic daily reset — or Low of Week (LoW) via weekly timeframe data
  • Displays all critical trade data in a clean, customizable on-screen table showing: Risk Amount, Stop Loss type (LoD/LoW), Stop Price, and calculated Shares Qty
  • Allows full table placement control with four corner positions with optional Top Offset and Bottom Offset (0–20 blank rows each) to prevent overlap with price action or other indicators
  • Provides complete visual styling control for header text/background, value text/background, and share quantity text/background
  • Ensures efficient rendering by recreating the table only when position, row count, or layout changes, deleting the prior instance to avoid flicker or memory issues
  • Handles edge cases safely: shows 0 shares if stop is 'na' or above current price, and initializes LoD only on the first RTH bar of each session
  • For use on equities only (table will not display on futures instruments)
    --
    Future improvements:
  • Visual Stop Loss line for either LoD or LoW
  • Functionality and toggle to include Extended hours (PM /AH) for LoD stop pricing

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.