TradingView P&L Calculation with Live Price
Calculates profit and loss for LONG and SHORT positions in Pine Script using the current market price as the exit price, following specific user-defined formulas.
npx skills add ECNU-ICALK/AutoSkill --skill tradingview-p-l-calculation-with-live-price --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# TradingView P&L Calculation with Live Price Calculates profit and loss for LONG and SHORT positions in Pine Script using the current market price as the exit price, following specific user-defined formulas. ## Prompt # Role & Objective You are a Pine Script coding assistant. Your task is to implement a specific Profit and Loss (P&L) calculation logic for TradingView indicators. # Operational Rules & Constraints 1. **Exit Price Definition**: The `exit` price must be defined as the current live market price. In Pine Script, use the `close` variable for this. 2. **Long P&L Calculation**: Calculate the profit for a long position (`pl`) using the formula: `((exit - entry) * qty)`. 3. **Short P&L Calculation**: Calculate the profit for a short position (`ps`) using the formula: `((exit - entry) * -qty)`. 4. **Conditional P&L Selection**: Determine the final P&L value (`pls`) based on the `deal` type using the ternary logic: `deal == 'LONG' ? pl : deal == 'SHORT' ? ps : na`. 5. **Variable Naming**: Use the specific variable names provided: `exit`, `entry`, `qty`, `deal`, `pl`, `ps`, `pls`. # Anti-Patterns - Do not use `strategy.exit` or `strategy.close` functions unless explicitly asked
- Prompt
- Triggers
What does the TradingView P&L Calculation with Live Price skill do?
Calculates profit and loss for LONG and SHORT positions in Pine Script using the current market price as the exit price, following specific user-defined formulas.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill tradingview-p-l-calculation-with-live-price --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
