> For the complete documentation index, see [llms.txt](https://d-app.gitbook.io/onlyfarm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://d-app.gitbook.io/onlyfarm/guide/strategy-rules.md).

# Strategy rules

Every filter, trigger and limit you can give an agent.

A rule has three parts: a metric, a comparison and a value. For example, *pool TVL ≥ $200,000* or *position ROI ≤ −15%*. Numbers use `>=` or `<=`, and yes/no metrics use *is* or *is not*. Many pool metrics also take a time window: **5m, 1h, 6h or 24h**.

* **Entry filters.** A pool has to pass **all** of them to be considered.
* **Exit triggers.** These are grouped into **conditions**. A condition fires when **every** rule in it is true, and **any** condition that fires closes the whole position. A condition with one rule is a plain stop. Put two rules in the same condition to say *"down 10% **and** the pool has gone quiet"*. In the config, **+ and** adds a rule to the same condition and **+ or** starts a new one.

You can have up to 40 entry filters, and up to 8 exit conditions with 40 rules between them.

{% hint style="info" %}
If the agent cannot evaluate a rule because the data is missing, the rule never counts as passed. On entry the pool is skipped. On exit the agent tells you that stop is not armed.
{% endhint %}

### Pool metrics

These work as entry filters and as exit triggers, unless marked otherwise.

| Metric                            | What it measures                                                                                    |
| --------------------------------- | --------------------------------------------------------------------------------------------------- |
| Pool TVL                          | Total value locked in the pool                                                                      |
| Pool volume *(window)*            | Traded volume                                                                                       |
| Fee APR *(window)*                | Fees relative to TVL, annualised. Short windows give very large numbers                             |
| Fee rate per day *(window)*       | The same yield, expressed per day                                                                   |
| Fee / TVL *(window)*              | Fees over TVL for the window, not annualised                                                        |
| Fee APR momentum *(5m, 1h, 6h)*   | This window's fee rate compared with the pool's 24h rate (+100% means double)                       |
| Pullback from the high *(window)* | How far the price is below the window's high                                                        |
| Mean reversion *(5m, 1h, 24h)*    | From 0 to 1: how much the price swings back and forth rather than trending                          |
| Price change *(window)*           | The signed price move. "Not down more than 40% in an hour" is *≥ −40%* on 1h                        |
| Trades *(window)*                 | Number of trades                                                                                    |
| Token marketcap                   | Market cap of the pool's main token                                                                 |
| Price drift                       | How far the price has wandered, a gauge of impermanent-loss risk                                    |
| Pool age                          | How long ago the pool was created. **Entry only**                                                   |
| Bin step (DLMM)                   | The pool's bin step. **Entry only**                                                                 |
| Paired with SOL                   | Whether one of the two tokens is SOL. STONK/SOL and SOL/USDC are, STONK/USDC is not. **Entry only** |

### Token safety

Mint authority renounced · freeze authority renounced · top-10 holder concentration · dev holding · LP locked · RugCheck flags · RugCheck danger flags · RugCheck risk score · rugged · insiders detected · token price change (1h, 24h) · token liquidity (all venues).

These are entry filters. **Rugged** is the exception: you can also use it as an exit trigger, so a position closes the moment RugCheck marks its token as rugged.

Token price change is measured on the token's deepest pool. Token liquidity adds up every venue the token trades on. Safety data comes from Jupiter, RugCheck and DexScreener. Not every token has every metric, and a token missing one fails that filter.

### Token tags

Tokens also carry **tags** from CoinGecko, GeckoTerminal and Jupiter, such as *Meme*, *Stablecoins*, *Decentralized Finance (DeFi)* or *verified*. OnlyFarm does not label tokens itself, and each tag shows where it came from. You can see them in the token panel on any pool page.

Tags are not a filter. The agent reads them when it chooses between the pools that passed your rules. So if you care about the kind of token, say it in your written instructions ("blue chips only", "no memecoins", "stablecoin pairs") and the agent will weigh each candidate's tags against that. A token that isn't listed on CoinGecko says so, which on its own separates most memecoins from established projects.

### Position metrics (exit only)

| Metric                  | Typical use                                                                                                                                                    |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Position ROI            | Return on what you put in, fees included. Stop-loss *≤ −15%*, take-profit *≥ +30%*                                                                             |
| Position ROI (SOL)      | The same return measured in SOL: what the position is worth in SOL against the SOL it cost, unaffected by the SOL price. Useful if you count your gains in SOL |
| Position age            | Time stop, for example *≥ 1 hour*                                                                                                                              |
| In range                | Exit the moment the price leaves your range: *in range is not true*                                                                                            |
| Distance out of range   | Exit once the price is a set percentage beyond the nearest edge of your range                                                                                  |
| Distance to upper range | Where the price is relative to the top of your range: positive above it, negative below it                                                                     |
| Distance to lower range | Where the price is relative to the bottom of your range: positive above it, negative below it                                                                  |
| Position value          | Current value of the liquidity                                                                                                                                 |
| Unclaimed fees          | In dollars, or as a percentage of the position                                                                                                                 |
| Position APR            | Yield earned so far, annualised                                                                                                                                |

### Market metrics

These work as entry filters and exit triggers.

| Metric                   | What it measures                                                                                                                             |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| SOL price                | SOL in US dollars                                                                                                                            |
| SOL 24h change           | How much SOL moved over the last day                                                                                                         |
| Market breadth (1h)      | Share of the market's largest pools that are up over the last hour. High means the whole market is rising, not only the pool in front of you |
| Median fee rate (market) | What a typical large pool is paying per day right now                                                                                        |

Breadth and the median fee rate come from the 150 largest pools on each venue, not from your own filters. A common use is *SOL 24h change ≥ −5%* as an entry filter, so the agent opens nothing while the market is falling.

### Scopes

Scopes are limits the agent always works within.

| Scope                     | Meaning                                                                                                                                                                                                                                                         |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Allowed protocols         | Meteora DLMM, Meteora DAMM v2, or both                                                                                                                                                                                                                          |
| Max position value        | Largest single position (0 means no cap)                                                                                                                                                                                                                        |
| Max positions             | Most positions open at once (0 means no cap)                                                                                                                                                                                                                    |
| Min TVL per pool          | Pools below this are never entered                                                                                                                                                                                                                              |
| Min range width           | Narrowest DLMM range the agent may use                                                                                                                                                                                                                          |
| Whitelist                 | Only these pools or tokens (empty means no restriction)                                                                                                                                                                                                         |
| Launchpads                | pump.fun, bonk.fun, bags.app and *not attributed*. *Not attributed* covers most of the market, including SOL/USDC and blue chips, so leave all four selected (or none) for no restriction                                                                       |
| DEX Paid only             | Only tokens with the DEX Paid badge                                                                                                                                                                                                                             |
| Allow non-refundable rent | Lets the agent open a range whose bin arrays don't exist yet. Meteora charges about 0.052 SOL per new bin array, usually two, and closing the position does not return it. Any wide range can need one, and a freshly launched pool always does. Off by default |
| Liquidity shape           | Auto (the agent picks), spot, curve or bid-ask                                                                                                                                                                                                                  |

### Presets

Presets are starting points. Apply one, then edit it to suit you.

| Preset             | Idea                                                                                                                            |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| **Quick Farm**     | Wide range on mid-cap, sideways tokens. Take-profit and stop-loss at 30%                                                        |
| **Simple Bid-Ask** | Bid-ask liquidity on a young, high-volume pool, held for about a day                                                            |
| **Degen Play**     | Full range on a token that just graduated. Farms the highest-volume pool for about 5 minutes, on DLMM or DAMM v2                |
| **Launch Sniper**  | A trade of a few minutes on a token launched hours ago. Exits when fees dry up, the price leaves the range, or after 30 minutes |
| **Chill Guy**      | High-cap coins in a tight range. Exits once the price is well outside the range                                                 |
| **Farm and Exit**  | New meme launches with heavy trading. Single-sided meme liquidity that sells into the pump                                      |
| **Bear Strategy**  | High-volume coins, SOL side only. Strict 5% take-profit and stop-loss, and exits as soon as the position is out of range        |

### Execution

| Setting              | Default | Meaning                                                                                                                                                                                                                          |
| -------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Max swap slippage    | 1%      | How far below its quote any swap may fill: entries, exits, harvests, compounds and sweeps                                                                                                                                        |
| Max pool price move  | 2%      | How far the pool's price may move between building a deposit or withdrawal and it landing. A bigger move cancels that step instead of depositing at the moved price                                                              |
| Max buy price impact | 3%      | The worst price impact a swap's quote may carry when the agent buys into a position (enter, add, compound, rebalance). A buy over it isn't sent and your SOL stays put. Sales are never blocked by it. Memecoin presets set 5–8% |
| Re-entry cool-down   | 4 hours | After any exit, the agent won't re-enter that token pair until this has passed                                                                                                                                                   |
| Cool-down            | 0       | Minimum gap after one agent action before the next on this vault. Exits are never held back by it                                                                                                                                |
| Priority tier        | Auto    | How hard the agent's transactions compete for block space: auto, low, medium, high or turbo                                                                                                                                      |

Every execution setting needs a value, and these are the numbers the agent uses: the AI can't loosen or tighten them for a trade.

Slippage and price impact are different checks. Slippage limits how far a swap may fill below its quote. Price impact is what the quote itself already costs, which on a thin pool can be several percent before any slippage. A refused buy shows as **Refused** in the activity feed, with the impact and your limit.

On DLMM the agent opens a new position in two steps: first the swap and the empty position, then the deposit, built from what actually landed and the price at that moment. That's why a small part of the swapped token can be left over after an entry; **Sweep** converts it back to SOL (it is on by default).

The re-entry cool-down covers the whole token pair, not only the pool the agent left. Leaving MET/SOL in one pool also rules out MET/SOL in every other pool, whatever its bin step or fee tier. A rebalance is not an exit and doesn't start the cool-down.
