OS Trading Engine
Getting Started
Core Concepts
Risk Management

Risk Management

Nexgent provides three primary trading strategy tools: Stop Loss to limit downside, Take Profit to lock in gains progressively, and DCA (Dollar Cost Averaging) to average into positions.


Overview

FeaturePurposeWhen It Triggers
Stop LossLimit lossesPrice drops below threshold
Take ProfitLock in gainsPrice rises to configured levels
DCALower average costPrice drops to configured levels

Stop Loss is always available. Take Profit and DCA can both be enabled on the same agent; the engine evaluates them independently (take-profit on price rises, DCA on price drops).


Stop Loss

What It Is

Stop loss automatically sells a position when the price drops below a configured threshold, limiting your losses.

How It Works

  1. Track peak price - Highest price since purchase
  2. Calculate threshold - Based on mode and configuration
  3. Evaluate on every price update - Sub-second checks
  4. Trigger sell - When current price ≤ threshold

Stop Loss Modes

Nexgent offers four stop loss calculation modes:

1. Fixed Mode

Linear steps based on price increase:

Stop Loss = Price Change - 10%
Price ChangeStop Loss (Keep %)
+10%Keep 0% (break even)
+50%Keep 40%
+100%Keep 90%
+200%Keep 190%

Best for: Simple, predictable protection

2. Exponential Mode

Starts loose, gets tighter as gains increase:

Stop Loss = 100 - (100 × e^(-change/50))
Price ChangeStop Loss (Keep %)
+25%Keep ~39%
+50%Keep ~63%
+100%Keep ~86%
+200%Keep ~98%

Best for: Letting winners run while protecting large gains

3. Zones Mode

Step-based zones with different keep percentages:

ZonePrice ChangeKeep %
Zone 110-50%60%
Zone 250-100%70%
Zone 3100-200%80%
Zone 4200-500%85%
Zone 5500%+90%

Best for: Balanced approach with clear levels

4. Custom Mode

Define your own trailing levels:

trailingLevels: [
  { change: 200, stopLoss: 90 },  // At 200%+, keep 90%
  { change: 100, stopLoss: 80 },  // At 100%+, keep 80%
  { change: 50, stopLoss: 40 },   // At 50%+, keep 40%
  { change: 10, stopLoss: 5 },    // At 10%+, keep 5%
]

Best for: Traders with specific strategies

Default Stop Loss

Before any price increase, the default stop loss applies:

stopLoss: {
  enabled: true,
  defaultPercentage: -32,  // Sell at 32% loss
  mode: 'fixed'
}

This means: if price drops 32% from purchase before any gains, sell.

Configuration Example

stopLoss: {
  enabled: true,
  defaultPercentage: -32,
  mode: 'exponential',
  trailingLevels: []  // Not used in exponential mode
}

Take Profit

What It Is

Take Profit automatically sells portions of your position as price rises, locking in gains at predefined milestones. Unlike stop loss (which sells everything at once), take profit sells incrementally.

Take Profit and DCA together: You can enable both. Take Profit sells on rises; DCA buys on drops. The engine supports both simultaneously.

How It Works

  1. Track gain percentage - Calculate current gain from purchase price
  2. Check levels - Has price reached a take-profit level?
  3. Execute partial sale - Sell configured percentage of original position
  4. Continue monitoring - Remaining position stays open for more gains

Take-Profit Modes

Nexgent offers five take-profit modes:

1. Aggressive Mode

Early profit-taking at lower thresholds:

Gain %Sell %Cumulative
25%25%25%
50%25%50%
100%25%75%
200%25%100%

Best for: Quick profits, volatile tokens

2. Moderate Mode (Default)

Balanced profit-taking across the gain curve:

Gain %Sell %Cumulative
50%25%25%
150%25%50%
300%25%75%
400%25%100%

Best for: Most traders, balanced approach

3. Conservative Mode

Higher targets to let winners run:

Gain %Sell %Cumulative
100%20%20%
200%20%40%
400%30%70%
600%30%100%

Best for: Strong conviction, momentum plays

4. Moon Bag Mode

Takes profits but retains 10% permanently:

Gain %Action
50%Sell 25%
150%Sell 25%
300%Sell 25% + Moon bag activated
400%Sell 15%
ForeverRetain 10%

Best for: "Never sell all" strategy

5. Custom Mode

Define your own levels:

levels: [
  { targetPercent: 50, sellPercent: 30 },
  { targetPercent: 100, sellPercent: 30 },
  { targetPercent: 200, sellPercent: 25 },
  { targetPercent: 500, sellPercent: 15 },
]

Moon Bag Feature

The moon bag feature retains a portion of your position indefinitely:

  • Trigger: Activates when price reaches configured gain % (e.g., 300%)
  • Retain: Keeps configured % of original position (e.g., 10%)
  • Duration: Held until stop loss triggers or manual close
  • Override: Stop loss sells everything, including moon bag
moonBag: {
  enabled: true,
  triggerPercent: 300,  // Activate at 300% gain
  retainPercent: 10     // Keep 10% forever
}

Key Concepts

Per-Level Calculation

Each level's sell amount is from the ORIGINAL position, not remaining:

Original: 1000 tokens
Level 1 (50% gain): Sell 25% of 1000 = 250 tokens
Level 2 (150% gain): Sell 25% of 1000 = 250 tokens (NOT 25% of 750)

Gap Handling

If price jumps over multiple levels, all missed levels execute together:

  • Levels at 50% and 100%, each selling 25%
  • Price jumps from 40% to 120%
  • Both levels trigger: 50% sold (25% + 25%)

Configuration Example

takeProfit: {
  enabled: true,
  levels: [
    { targetPercent: 50, sellPercent: 25 },
    { targetPercent: 150, sellPercent: 25 },
    { targetPercent: 300, sellPercent: 25 },
    { targetPercent: 400, sellPercent: 15 },
  ],
  moonBag: {
    enabled: true,
    triggerPercent: 300,
    retainPercent: 10
  }
}

DCA (Dollar Cost Averaging)

DCA and Take Profit: Both can be enabled on the same agent. DCA buys on dips; Take Profit sells on rises. The engine evaluates both independently.

What It Is

DCA automatically buys more of a token when its price drops, lowering your average cost basis.

How It Works

  1. Monitor price vs average - Track current price against your average purchase price
  2. Check DCA levels - Has price dropped to a configured level?
  3. Execute buy - Purchase more tokens
  4. Update average - Recalculate weighted average price

DCA Modes

1. Aggressive Mode

Tighter levels, more frequent DCAs:

Drop %Buy % of Position
-10%50%
-20%50%
-30%50%
-40%50%

Best for: High conviction plays, averaging aggressively

2. Moderate Mode (Default)

Balanced approach:

Drop %Buy % of Position
-15%50%
-30%50%
-45%50%

Best for: Most traders

3. Conservative Mode

Wider levels, fewer DCAs:

Drop %Buy % of Position
-20%50%
-40%50%

Best for: Lower risk tolerance

4. Custom Mode

Define your own levels:

levels: [
  { dropPercent: -15, buyPercent: 30 },
  { dropPercent: -30, buyPercent: 40 },
  { dropPercent: -50, buyPercent: 50 },
]

DCA Safeguards

Max DCA Count

Limits how many times you can DCA into a position:

dca: {
  maxDCACount: 3  // Maximum 3 additional buys
}

This prevents unlimited buying into a "falling knife."

Cooldown Period

Minimum time between DCAs:

dca: {
  cooldownSeconds: 30  // Wait 30 seconds between DCAs
}

Prevents rapid-fire DCAs during volatile price swings.

Configuration Example

dca: {
  enabled: true,
  mode: 'moderate',
  levels: [],  // Not used in preset modes
  maxDCACount: 3,
  cooldownSeconds: 30
}

Strategy Comparison

These features address different market scenarios:

ScenarioStop LossTake ProfitDCA
Price dropsSell (limit loss)No actionBuy (lower average)
Price risesTrail higherSell (lock gains)No action
GoalProtect capitalSecure profitsImprove entry
Enabled by defaultYesNoNo

Strategy Combinations

Stop Loss + DCA (DCA mode):

  1. Price drops 15% → DCA triggers (buy more)
  2. Price drops 32% from new average → Stop loss triggers (sell all)

This allows you to average down on dips while still having downside protection.

Stop Loss + Take Profit (Take Profit mode):

  1. Price rises 50% → Take profit sells 25%
  2. Price rises 150% → Take profit sells another 25%
  3. Price reverses and drops → Stop loss protects remaining position

This locks in gains progressively while protecting against reversals.

Stop Loss + Take Profit + DCA (all three enabled):

  1. Price rises → Take profit sells at configured levels
  2. Price drops → DCA buys more at configured levels
  3. Price drops further → Stop loss protects (sells all remaining, including moon bag)

You can enable both Take Profit and DCA; the engine evaluates them independently on each price update. Stop Loss works with both.


Practical Examples

Example 1: Conservative Setup (Stop Loss Only)

"I want minimal risk, no additional buying or selling"

{
  stopLoss: {
    enabled: true,
    defaultPercentage: -20,  // Tight stop
    mode: 'fixed'
  },
  dca: { enabled: false },
  takeProfit: { enabled: false }
}

Example 2: DCA Setup (Average Down Strategy)

"I have high conviction and want to average down on dips"

{
  stopLoss: {
    enabled: true,
    defaultPercentage: -50,  // Wide stop
    mode: 'exponential'
  },
  dca: {
    enabled: true,
    mode: 'aggressive',
    maxDCACount: 4
  },
  takeProfit: { enabled: false }
}

Example 3: Take Profit Setup (Lock In Gains Strategy)

"I want to lock in profits progressively as price rises"

{
  stopLoss: {
    enabled: true,
    defaultPercentage: -32,
    mode: 'zones'
  },
  dca: { enabled: false },
  takeProfit: {
    enabled: true,
    mode: 'moderate',
    moonBag: { enabled: true, triggerPercent: 300, retainPercent: 10 }
  }
}

Example 4: Balanced Setup with DCA

"Standard risk management with averaging down"

{
  stopLoss: {
    enabled: true,
    defaultPercentage: -32,
    mode: 'zones'
  },
  dca: {
    enabled: true,
    mode: 'moderate',
    maxDCACount: 2
  },
  takeProfit: { enabled: false }
}

Configuring in the Dashboard

  1. Navigate to Agent Profile in the sidebar
  2. Under Trading Strategy, select the Stop Loss tab to configure stop loss settings
  3. Under Trading Strategy, select the Take Profit tab to configure take-profit settings
  4. Under Trading Strategy, select the DCA tab to configure DCA settings
  5. Modify settings as needed

All changes auto-save automatically. You'll see "Saving...", "Saved", or "Save failed" indicators. Take Profit and DCA can both be enabled on the same agent.


Best Practices

Stop Loss

  1. Always enable stop loss - Even a wide stop is better than none
  2. Match to volatility - Tighter for stable tokens, wider for volatile
  3. Consider the token - Some tokens are more volatile than others
  4. Review and adjust - Check if your stops are triggering too early or too late

Take Profit

  1. Lock in gains progressively - Don't wait for one big exit
  2. Consider moon bag - Keep exposure to potential further gains
  3. Match levels to conviction - Higher conviction = higher targets
  4. Validate allocation - Ensure total sell % + moon bag ≤ 100%

DCA

  1. Don't over-DCA - Set reasonable maxDCACount limits
  2. Consider total exposure - DCA increases your position size
  3. Use cooldowns - Prevent emotional rapid-fire buying
  4. Have conviction - Only DCA into positions you believe will recover

General

  1. Combine strategies as needed - Take Profit and DCA can both be enabled; the engine supports them simultaneously
  2. Test in simulation - See how your settings perform
  3. Review historical swaps - Learn from past trades
  4. Adjust based on results - Optimize over time

FAQ

Can I use Take Profit and DCA together?

Yes. You can enable both on the same agent. Take Profit sells portions when price rises; DCA buys more when price drops. The engine evaluates both independently on each price update, so you can lock in gains on rises and average down on dips in the same position.

What if stop loss and DCA conflict?

They don't directly conflict. DCA adds to your position, then stop loss is calculated against your new average price.

What if stop loss and Take Profit conflict?

They don't conflict — they complement each other. Take Profit locks in gains on rises; stop loss protects on drops. Stop loss overrides Take Profit's moon bag (sells everything).

Can I disable all three?

Yes, but not recommended. Without stop loss, losses are unlimited. Without Take Profit or DCA, you rely entirely on manual management.

How is the stop loss price calculated?

Stop Price = Peak Price × (Stop Loss % / 100)

Example: Peak = $1.00, Stop Loss = 85% → Sells at $0.85

How is take-profit calculated?

Each level's sell amount is from the original position:

Sell Amount = Original Tokens × (Sell % / 100)

Example: 1000 tokens, Level 1 sells 25% → Sells 250 tokens

Does DCA update my average price?

Yes. After each DCA:

New Average = Total SOL Invested / Total Tokens Held

Does Take Profit affect my average price?

No. Take Profit sells tokens but doesn't change your purchase price for P/L calculations. The profit is "realized" when you sell.