๐Ÿ“˜ GitBook: DCA Bot โ€“ Complete Lifecycle Guide

1 Introduction โ€“ What is a DCA Bot?

What is Dollar Cost Averaging (DCA)?

A DCA bot is an automated trading strategy that:

  • Buys an asset in multiple steps as price moves

  • Reduces average buy price

  • Sells the entire position at a predefined Take Profit (TP) or Stop Loss (SL)

What your DCA bot does

Your bot:

  • Automatically places BUY orders

  • Tracks average price

  • Places SELL orders when TP or SL is hit

  • Calculates realized profit or loss

  • Works fully automatically once started


2 Creating a DCA Bot (Bot Setup)

When a user creates a bot, they configure:

Required Inputs

  • Trading Pair (e.g. BTC/USDT)

  • Base Order Amount

  • Safety Order Amount

  • Max Safety Orders

  • Price Deviation (%)

  • Take Profit (%)

  • Stop Loss (%)


3 Starting the Bot

When user clicks START BOT:

Internally

  • Bot status changes to running

  • Bot places the first BUY order (Base Order)

  • Bot starts monitoring price using exchange data

Important

  • This BUY is not profit

  • It only opens a position


4 How BUY Orders Work (DCA Logic)

Base Order

  • First BUY order

  • Opens the position

Safety Orders

  • Triggered when price drops by configured deviation

  • Each safety order:

    • Buys more

    • Lowers average buy price

Example


5 Average Price Calculation

Your bot constantly recalculates:

This average price is used for:

  • Take Profit check

  • Stop Loss check


6 Take Profit (TP) Logic

What is Take Profit?

Take Profit is the price at which:

  • Bot sells entire position

  • Locks in profit

When TP is hit

  • Bot places a SELL order

  • Bot closes the trade

  • Bot status becomes stopped

Internally

  • SELL order is stored

  • Realized P&L is calculated

  • Bot lifecycle ends successfully


7 Stop Loss (SL) Logic

What is Stop Loss?

Stop Loss limits loss if market moves against you.

When SL is hit

  • Bot places a SELL order

  • Loss is realized

  • Bot status becomes stopped

Important

  • SL trades are included in P&L

  • Bot is not deleted automatically


8 Manual Bot Stop / Delete

If user stops a bot manually

  • Bot places SELL order (if position open)

  • P&L is realized

  • Bot status = stopped

If user deletes a bot

  • Bot record is removed

  • Orders remain in history

  • P&L is still included in user stats

โš ๏ธ Deleting a bot does NOT delete trade history


9 Orders & Trade History

BUY Orders

  • Open or increase position

  • Do NOT count as profit

SELL Orders

  • Close position

  • Generate realized profit or loss

All orders are visible in:

  • Trade history

  • Dashboard orders table


10 Realized P&L (Most Important)

What is Realized P&L?

Realized P&L is:

Actual profit or loss after a SELL order is completed

Included in Realized P&L

TP hit SL hit Manual stop Deleted bots Running bots (once sold)

Not included

โŒ Open positions โŒ Unrealized profit


11 User-Level P&L (Dashboard)

Dashboard shows:

  • Total realized P&L (all bots combined)

  • Buy trades count

  • Sell trades count

How it is calculated

  • FIFO method (first buy โ†’ first sell)

  • Based only on SELL orders


12 Bot Status Meaning

Status
Meaning

created

Bot configured, not started

running

Bot actively trading

stopped

TP / SL / manual stop

deleted

Bot removed, history preserved


13 Full Bot Lifecycle (Visual)


14 Risk Disclaimer (IMPORTANT)

  • DCA does NOT guarantee profit

  • Market conditions can cause losses

  • Always configure Stop Loss

  • Use risk management


15 Summary

  • Bots automate buying & selling

  • Profit is realized only on SELL

  • Dashboard shows combined P&L

  • Deleted bots still count

  • You are always in control

Last updated