Page cover

DCA

πŸ“Œ Standard Deviation DCA Strategy

Automated position building using statistical price bands

A smart accumulation algorithm that executes buy/sell orders when price deviates significantly from its mean, with flexible order sizing and LIFO profit-taking options.


βš™οΈ Core Parameters

Parameter
Example
Description

Amount

5000

Target token volume

Order_size_min

50

Base order size (in tokens)

Price_Low

2

Lower price boundary

Price_High

4

Upper price boundary

Period

1d

Order triggering frequency

Window_Size

21

Candles for mean/std calculation

Buy_Threshold

3

Buy when price < (mean - 3Οƒ)

Sell_Threshold

2

Sell when price > (mean + 2Οƒ)


πŸ“Š Order Sizing Modes

1. Classic

  • Fixed-size orders: Order_size_min tokens per trade

2. Martingale

  • Order size increases exponentially from Price_High to Price_Low

3. Logarithmic

  • Calculated per:

    Where:

    • S = Order_size_min

    • M = Multiplier (e.g., 1.05)

    • n = Trade count


πŸ“Œ Example: Buying TON with SD-DCA

Setup:

  • Mean price: 3.00,Οƒ=3.00,Οƒ=0.20

  • Buy trigger: 3.00βˆ’(3Γ—3.00βˆ’(3Γ—0.20) = $2.40

  • Log mode: M=1.05, S=50 TON

Execution:

  1. Trade #1 at $2.40:

    • Size = 50 Γ— (1 + 1.05Γ—ln(1)) = 50 TON

  2. Trade #5 at $2.20:

    • Size = 50 Γ— (1 + 1.05Γ—ln(5)) = 131 TON

LIFO Selling:

  • If price rebounds to $2.80 (mean + 2Οƒ):

    • Sells most recent buy first


πŸ” Key Features

βœ… Statistical edge - Buys at statistically "low" prices βœ… Flexible scaling - Choose risk profile via order sizing βœ… Auto-profit taking - LIFO selling locks gains


πŸ›‘ Risk Controls

βœ” Price boundaries prevent extreme executions βœ” Configurable Οƒ thresholds adjust sensitivity βœ” Real-time PnL tracking


πŸ“Š Performance Tracking

  • Realized PnL per closed position

  • Net average entry price

  • Missed signal diagnostics


πŸ”₯ Ideal For:

  • Accumulating during market dips

  • Mean-reversion strategies

Last updated