OPEN-SOURCE SCRIPT
Simple Perps Calculator

## Simple Perps Calculator (Long & Short)
A lightweight on-chart trade calculator that visualizes **entry, take-profit, and liquidation levels** with leverage-adjusted returns — designed for fast planning and clean charts.
This indicator automatically detects **long or short positions** based on your target price and adjusts calculations accordingly. All key levels are displayed as **colored horizontal price lines** with matching labels positioned near the price scale for easy reference.
---
### Features
- Entry, Take-Profit, and Liquidation price levels
- Automatic **long / short detection**
- Leverage slider up to **1000×**
- Leveraged **percent gain** calculation
- Color-coded horizontal price lines:
- 🟡 Entry
- 🟢 Take-Profit
- 🔴 Liquidation
- Adjustable label positioning (left or right of chart)
- Horizontal offset control to move labels out of the way
- Clean, minimal, non-intrusive design
---
### How to Use
1. Set your **Entry Price**
2. Set your **Target Price**
3. Adjust **Leverage**
4. Move labels using the **horizontal offset** slider if needed
If the target price is above entry, the script assumes a **long** position. If below, it assumes a **short** position and places the liquidation level above entry automatically.
---
### Notes
- Liquidation price uses a simplified isolated-margin model
- Intended for **planning and visualization only**
- Actual exchange liquidation prices may vary due to fees and maintenance margin requirements
A lightweight on-chart trade calculator that visualizes **entry, take-profit, and liquidation levels** with leverage-adjusted returns — designed for fast planning and clean charts.
This indicator automatically detects **long or short positions** based on your target price and adjusts calculations accordingly. All key levels are displayed as **colored horizontal price lines** with matching labels positioned near the price scale for easy reference.
---
### Features
- Entry, Take-Profit, and Liquidation price levels
- Automatic **long / short detection**
- Leverage slider up to **1000×**
- Leveraged **percent gain** calculation
- Color-coded horizontal price lines:
- 🟡 Entry
- 🟢 Take-Profit
- 🔴 Liquidation
- Adjustable label positioning (left or right of chart)
- Horizontal offset control to move labels out of the way
- Clean, minimal, non-intrusive design
---
### How to Use
1. Set your **Entry Price**
2. Set your **Target Price**
3. Adjust **Leverage**
4. Move labels using the **horizontal offset** slider if needed
If the target price is above entry, the script assumes a **long** position. If below, it assumes a **short** position and places the liquidation level above entry automatically.
---
### Notes
- Liquidation price uses a simplified isolated-margin model
- Intended for **planning and visualization only**
- Actual exchange liquidation prices may vary due to fees and maintenance margin requirements
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.