# Custom Distribution

Besides the three basic liquidity distributions, Ferra allows users to manually specify the exact liquidity amount for each bin—offering full control over placement for advanced strategies and precise position management.

### Basic Implementation

```typescript
// Manual distribution - you control everything
const tx = await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: 5000000000n,
  amountY: 10000000000n,
  deltaIds: [-10, -5, -1, 0, 3, 7, 10],  // Specific bins
  distributionX: [0, 0, 10, 30, 60, 0, 0],   // Custom weights
  distributionY: [5, 15, 40, 30, 10, 0, 0]   // Different for each token
});
```

### Strategic Placements

#### Limit Order Style

```typescript
// Single bin acts like limit order
await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: sellAmount,
  amountY: 0n,
  deltaIds: [5],  // 5 bins above current
  distributionX: [100],
  distributionY: [0]
});
```

#### Support/Resistance Levels

```typescript
// Place at key price levels
const supportBin = -15;   // Support level
const resistanceBin = 20; // Resistance level

await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX,
  amountY,
  deltaIds: [supportBin, 0, resistanceBin],
  distributionX: [20, 30, 50],  // More at resistance
  distributionY: [50, 30, 20]   // More at support
});
```

#### Ladder Strategy

```typescript
// DCA-style ladder
const ladderBins = [-20, -15, -10, -5];
const equalWeight = 100 / ladderBins.length;

await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: 0n,  // Buy ladder
  amountY: buyAmount,
  deltaIds: ladderBins,
  distributionX: Array(ladderBins.length).fill(0),
  distributionY: Array(ladderBins.length).fill(equalWeight)
});
```

### Advanced Patterns

#### Barbell Strategy

```typescript
// Concentrate at extremes
const deltaIds = [-20, -19, 0, 19, 20];
const distributionX = [0, 0, 20, 40, 40];
const distributionY = [40, 40, 20, 0, 0];
```

#### Asymmetric Distribution

```typescript
// Different shapes for buy/sell
const deltaIds = Array.from({length: 21}, (_, i) => i - 10);
const distributionX = deltaIds.map(id => id > 0 ? id * 2 : 0);
const distributionY = deltaIds.map(id => id < 0 ? Math.abs(id) * 3 : 0);

// Normalize to 100
normalize(distributionX);
normalize(distributionY);
```

### Use Cases

✅ **Perfect for:**

* Technical analysis levels
* Limit order simulation
* Complex strategies
* Precise positioning

❌ **Avoid if:**

* New to DLMM
* Want simple management
* Need quick setup

### Tips & Best Practices

1. **Plan First**: Map out bins before executing
2. **Test Small**: Try strategy with minimal amounts
3. **Track Performance**: Monitor which bins perform best
4. **Adjust Actively**: Custom positions need management

### Common Strategies

* **Range Orders**: Single bins at target prices
* **Fibonacci Levels**: Place at fib retracements
* **Volume Profile**: Match historical volume
* **Mean Reversion**: Concentrate at extremes

### Related Topics

* [Calculate Token Amounts](/integration/dlmm/typescript-sdk/add-liquidity/calculate-token-amounts.md) - Preview requirements
* [Add to Existing Position](/integration/dlmm/typescript-sdk/add-liquidity/add-to-existing-position.md) - Modify custom positions


---

# Agent Instructions: 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.ferra.ag/integration/dlmm/typescript-sdk/add-liquidity/custom-distribution.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.
