OPEN-SOURCE SCRIPT
Position Sizer (Share Qty)

- 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
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.