# Your First Script in Furge (/scripting-v2/furge)



## 1. Open an example [#1-open-an-example]

Open [Scripts in Furge](https://cloud.marketlab.sh/scripts), sign in, and choose **Examples**. Select **Watch candle closes**, then **Use example**. This creates a separate script; it never replaces an existing one.

You do not need to install Python or fund an exchange account to write this example. Running it requires a ready Furge runtime. If your runtime is stopped, start it from **Runtime** first.

```python
script = {"name": "candle-monitor", "version": "2", "lookback": 2}
SOURCE = "btc@candles@hyperliquidf:timeframe=60"


def on_data(ctx, history):
    candle = history.source(SOURCE, 0)
    if candle is None:
        return
    print(f"BTC close: {candle['c']} | volume: {candle['volume']}")
    return {"metrics": {"close": candle["c"], "volume": candle["volume"]}}
```

This script only reads data and prints output. It contains no order or swap calls.

## 2. Understand the source [#2-understand-the-source]

`btc@candles@hyperliquidf:timeframe=60` means BTC candles from Hyperliquid with a 60-second interval. It is not an execution instruction.

`history.source(SOURCE, 0)` returns the newest retained candle, or `None` before one is available. Read [Candles](/scripting-v2/furge/sources/candles) for the complete returned dictionary. Use **Data sources** in the editor to find the other source types and exchange support.

Edits save automatically. Wait for **Saved** before leaving; starting a run also saves the current revision.

## 3. Run a historical backtest [#3-run-a-historical-backtest]

In **Run settings**, choose a recent completed UTC range under **Historical backtest**, then click **Backtest**. No trading wallet or real funds are used.

The **Backtests** panel below the editor shows progress. When the run completes:

* **Results:** the latest `close` and `volume` metrics. Zero closed trades is correct for this read-only script.
* **Logs:** one printed line per processed candle, such as `BTC close: 80500.0 | volume: 12.4` (illustrative values).
* **Source:** the exact saved Python revision used by that run.
* **Artifacts:** files explicitly produced by your script; this example creates none.

If no records arrive, check the source's historical support and date range. A live-only source cannot be backtested, even when the terminal chart has history.

## 4. Observe it live [#4-observe-it-live]

Set a short **Duration** under **Bot deployment**, then click **Deploy bot**. Review the confirmation and deploy. The same read-only example still contains no trading instructions; deployment itself is not an instruction to buy.

Furge opens the job page. Watch **Results** for events or **Logs** for Python output. A 60-second candle appears only after a complete interval with trades; the first partial interval is discarded. A quiet feed does not necessarily mean a failed job.

Click **Stop** to end the job. Closing the editor or browser does not stop it. Reopen it from **Scripts → Jobs**.

## 5. Add trading deliberately [#5-add-trading-deliberately]

Use [Execution](/scripting-v2/furge/execution) to choose supported actions for your exchange. Furge scripts use configured automated trading accounts, not your browser wallet. For Montra, fund the **Elysium Automated Trading Wallet** with the input asset and HYPE for gas.

Backtest supported strategies before enabling real execution. Montra and Nest contract actions run live. Stopping a job prevents future requests but does not cancel resting orders or reverse transactions already submitted.

Next: [Examples](/scripting-v2/furge/examples) · [Data Sources](/scripting-v2/furge/sources) · [Monitoring and Troubleshooting](/scripting-v2/furge/monitoring).
