# Cockpit

### Overview

The **Cockpit** serves as the real-time trading terminal within the Lune platform. It delivers a unified interface for monitoring accounts, managing positions, tracking orders, and reviewing trades. This terminal integrates interactive charting capabilities directly with comprehensive order entry functions. Access to the Cockpit is included with every connection plan.

### Layout and Navigation

The interface is structured into four primary sections to ensure streamlined navigation:

* **Top Bar:** Contains the market data bar, symbol selector, and timeframe selector.
* **Center:** Displays the interactive trading chart.
* **Right Panel:** Houses the complete order entry form.
* **Bottom Panel:** Features tabbed data panels detailing Positions, Orders, Trades, and Account information.

#### Market Bar and Symbol Selector

The Market Bar provides current data for the actively selected symbol. This includes Last Price, absolute and percentage Change, Session High (H), Session Low (L), and Session Volume (V).

The Symbol Selector can be accessed by clicking the symbol name or pressing any letter key on your keyboard. Supported markets include:

* **Equity Index:** ES, MES, NQ, MNQ, YM, MYM, RTY, M2K
* **Metals:** GC, MGC, SI, SIL, HG, MHG, PL
* **Energy:** CL, MCL, NG, MNG, RB, HO, QM, QG
* **Agriculture:** ZC, ZS, ZW, ZL, ZM
* **Treasuries:** ZT, ZN, ZB, ZF, TN, UB
* **Currencies:** 6E, 6J, 6B, 6A, 6C, 6S, 6N, 6M, E7, M6E, M6A, M6B, MSF, MJY
* **Livestock:** LE, HE, GF
* **Crypto:** BTC, MBT, MET

#### Timeframe Selector

Users can utilize quick buttons for standard timeframes **(30s, 1m, 5m, 15m, 30m, 1H, 4H, D)**. Custom timeframes can be accessed by pressing any digit key to open the modal. Input formats such as "30s", "3m", "2h", or "3d" are supported, requiring a minimum duration of 30 seconds.

### Charting

The central candlestick chart updates in real time via WebSocket connections, featuring sub-100ms latency with a 5-second background HTTP sync fallback. The chart initially loads 5,000 bars and lazy-loads up to 30,000 bars as the user scrolls horizontally.

**Chart Overlays:**

* **Position Entry Lines:** Indicate your entry price, direction (green for long, red for short), current quantity, and real-time PnL.
* **Working Order Lines:** Displayed as dashed horizontal markers at limit prices, which are fully draggable for quick modification.
* **TP/SL Bracket Lines:** Visual representations of Take Profit (green) and Stop Loss (red) lines that can also be adjusted by dragging.

**Quick Controls:**

* Right-clicking the chart opens a context menu to place Buy/Sell Market orders or Buy/Sell Limit orders snapped to the nearest tick.
* Pressing Alt+R resets the chart view to the default zoom and position.

### Order Entry

The right panel is dedicated to trade execution and active position management.

#### Account Selector

The dropdown menu displays all connected accounts, allowing searches by account name, ID, provider, or balance. A green dot indicates an active connection. For copy trading leaders, the follower count is also displayed.

#### Order Parameters

| **Side**          | Specifies trade direction: Buy (green) or Sell (red).                                                            |
| ----------------- | ---------------------------------------------------------------------------------------------------------------- |
| **Contracts**     | Sets the desired quantity (minimum of 1).                                                                        |
| **Limit Price**   | Defines the exact execution price (required for Limit orders only).                                              |
| **Time-in-Force** | "Linked" auto-cancels when the associated position closes; "GTC" (Good Till Cancelled) stays open independently. |

#### Bracket Orders (TP/SL)

Take Profit and Stop Loss levels can be configured using four distinct modes:

* **Price:** Defines the exact price level (e.g., 5050.00).
* **Ticks:** Defines the distance in ticks from the entry point.
* **$:** Sets a specific dollar profit or loss target.
* **%:** Sets a percentage-based profit or loss target.

#### Open Position Management

When a position is active on the selected symbol, the interface displays the quantity, side, unrealized PnL, and active brackets. Users can quickly interact with the position using the Flatten button to close it immediately, the Set TP/SL button to modify brackets, or the Cancel All button to clear working orders. Additional Quick Actions include Join Bid and Join Ask for rapid limit placement.

### Data Panels

The bottom section organizes trade data into four specific tabs. All tables support column sorting, visibility customization, and persistent preferences across sessions.

* **Positions Tab:** Displays active positions with columns for Symbol, Account, Qty, Entry, Unrealized PnL, TP/SL, Source, and Action. Users can edit brackets, close positions, or untrack items already closed at the broker.
* **Orders Tab:** Logs working and historical orders with filters for All, Open, Filled, Rejected, or Canceled status. Allows cancellation of working orders or modification of Time-in-Force limits.
* **Trades Tab:** Summarizes executed trades showing Entry, Exit, PnL, and the Source of the execution.
* **Account Tab:** Outlines provider details, status, balance, and overall equity. Includes a global Flatten All button to close positions across all accounts simultaneously.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lunefi.com/lune-platform/cockpit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
