OPEN-SOURCE SCRIPT
Mis à jour Risk & Position Sizing Calculator

Risk & Position Sizing Calculator with Signal Add-on
---
LEGAL DISCLAIMER — READ FIRST
**This script and this description are for EDUCATIONAL PURPOSES ONLY.**
- This is **not** investment advice, a trading recommendation, or a solicitation to buy or sell any stock, index, or F&O (Futures & Options) contract.
- Nothing in this script or description constitutes a recommendation to trade Nifty, Bank Nifty, or any stock, in cash, futures, or options.
- The script does **not** predict market direction and does **not** guarantee profit. Past performance of any rule-set (including the EMA-crossover logic used here) does not guarantee future results.
- Trading in equities, futures, and options carries a **high risk of loss**, including the possible loss of your entire invested capital, and is not suitable for everyone.
- All entries, exits, position sizes, and trading decisions remain **solely your own responsibility**.
- Please independently verify all information and **consult a SEBI-registered Investment Adviser** before making any trading or investment decision.
- The creator of this script accepts **no liability** for any financial loss arising from its use.
By using this script, you acknowledge that you understand and accept the above.
---
1. What This Script Is
A **risk and position-sizing calculator** for TradingView, with an **optional mechanical signal add-on**. It does two separate jobs:
1. **Risk Calculator (always on):** tells you how many lots you could safely trade on any chart (Nifty, Bank Nifty, or a stock), given your capital and risk tolerance — the math, not a prediction.
2. **Signal Add-on (optional, toggle on/off):** plots a Buy marker based on one fixed technical rule (EMA crossover, optionally RSI-filtered), then tracks that trade and marks profit-booking levels (T1/T2/T3) and stop-loss on the chart, with alerts.
---
LEGAL DISCLAIMER — READ FIRST
**This script and this description are for EDUCATIONAL PURPOSES ONLY.**
- This is **not** investment advice, a trading recommendation, or a solicitation to buy or sell any stock, index, or F&O (Futures & Options) contract.
- Nothing in this script or description constitutes a recommendation to trade Nifty, Bank Nifty, or any stock, in cash, futures, or options.
- The script does **not** predict market direction and does **not** guarantee profit. Past performance of any rule-set (including the EMA-crossover logic used here) does not guarantee future results.
- Trading in equities, futures, and options carries a **high risk of loss**, including the possible loss of your entire invested capital, and is not suitable for everyone.
- All entries, exits, position sizes, and trading decisions remain **solely your own responsibility**.
- Please independently verify all information and **consult a SEBI-registered Investment Adviser** before making any trading or investment decision.
- The creator of this script accepts **no liability** for any financial loss arising from its use.
By using this script, you acknowledge that you understand and accept the above.
---
1. What This Script Is
A **risk and position-sizing calculator** for TradingView, with an **optional mechanical signal add-on**. It does two separate jobs:
1. **Risk Calculator (always on):** tells you how many lots you could safely trade on any chart (Nifty, Bank Nifty, or a stock), given your capital and risk tolerance — the math, not a prediction.
2. **Signal Add-on (optional, toggle on/off):** plots a Buy marker based on one fixed technical rule (EMA crossover, optionally RSI-filtered), then tracks that trade and marks profit-booking levels (T1/T2/T3) and stop-loss on the chart, with alerts.
Notes de version
ns on top of any chart (Nifty, Bank Nifty, or a stock) and answers: "If I enter here, how many lots can I safely trade given my capital and risk tolerance?"1. Inputs (4 setting groups)
Capital & Risk — your capital, risk % per trade, and Caution/High-Risk thresholds that color-code the dashboard.
Stop-Loss Method — ATR-based (volatility-derived) or Swing High/Low (distance to recent swing point).
Contract Details — lot size (65 for Nifty by default, editable) and direction (Long/Short).
Targets — T1/T2/T3 as multiples of your risk (1R, 2R, 3R), mirroring the T1/T2/T3 in your original screenshot.
2. Calculations
Uses current close as "entry."
Computes stop-loss distance via ta.atr() × multiplier, or highest/lowest price over your lookback.
Derives stop-loss price and the three target prices as R-multiples from entry.
Computes risk amount (capital × risk%), risk per lot (SL distance × lot size), and max safe lots (risk amount ÷ risk per lot) — the same math behind "Safe Lots" in your dashboard tool.
Flags a zone: SAFE / CAUTION / HIGH RISK based on your risk % vs. the thresholds.
3. Visuals
Dashed/dotted lines on the chart for entry, stop-loss, and the three targets.
A dashboard table (top-right corner) showing all the numbers, updated on the latest bar.
What it doesn't do: pull option-chain data (strike, premium, decay) — not accessible
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
An advanced technical indicator built for the TradingView platform, intended for educational and informational purposes only. It does not constitute financial advice or a recommendation to buy or sell any security
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
An advanced technical indicator built for the TradingView platform, intended for educational and informational purposes only. It does not constitute financial advice or a recommendation to buy or sell any security
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.