OPEN-SOURCE SCRIPT

[Kpt-Ahab] Planned Order Visualizer IND

233
This Script visualizes planned long or short positions, including an optional existing position size, average entry price, up to three planned entries, a stop-loss level, and an estimated liquidation price. The current position can be treated either as already open or as a new planned entry. In simulation mode, all active entries are included in the calculation immediately, while in live mode only triggered price levels are included. Additional safety settings help prevent historical alerts and can optionally block entry or SL levels that would trigger immediately. The script is designed for planning, visualization, and alerting of planned positions.



snapshot
**Tips**

* Use **Simulation** mode to preview how all active entries affect the average price before any live alerts are enabled.
* Use **Live** mode only when you want the script to track price-level triggers in real time.
* Keep **Trigger only in realtime** enabled when using alerts, to avoid historical alert triggers after loading the script.
* Use **Block marketable entry limits** and **Block marketable SL** to prevent levels that would trigger immediately.
* Increase the **Reset counter** only when you intentionally want to reset all triggered states and prepare a fresh setup.
* The liquidation price is an estimate for planning purposes and may differ from the exact exchange liquidation price.




This script currently uses a fixed entry structure with `E0` plus `E1`, `E2`, and `E3`. To increase the number of planned entries, duplicate the existing entry blocks and keep the same naming pattern.

For every additional entry, add:

* new input fields for active state, price, and quantity
* new submitted and triggered flags
* average price quantity/value calculations
* price-allowed and price-hit logic
* alert trigger logic
* line and label objects
* table rows if the entry should be shown in the info table

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.