Learn · Course · Crypto · 10 lessons · about 45 min
Automate crypto, from your first demo trade to live.
Start from zero: long, short and leverage in plain words, then every screen of a real bot, step by step on the actual app. Each lesson has a hands-on example and one quick question, so nothing surprises you when you build your own.
0 of 10 lessons doneAbout 45 minutes in all
Lesson 1 of 10 · Crypto trading in plain words
Crypto course done. You’re ready to automate.
You know how to connect your exchange, set the bot’s size, exits and limits, send it TradingView alerts and read every result. Build it on demo, watch it for a while, then switch the same bot to your live account.
Before a bot trades for you, a few words need to make sense: long and short, perpetual futures, margin, leverage, liquidation and fees. Each one is explained here with real numbers, then you can try them.
In this lesson
Long and short
Perpetual futures and USDT
Margin, leverage and ROI
Liquidation, fees and funding
Long and short
A trade is a bet on direction. Going long, or buying, makes money when the price rises. Going short, or selling, makes money when it falls. On a futures exchange you can do either from the same balance, without owning the coin.
A signal that says Buy opens a long. A signal that says Sell opens a short.
Long · BuyProfits when the price goes up.
Short · SellProfits when the price goes down.
Real screen
Perpetual futures
Most crypto bots trade perpetual futures, or perps: contracts that follow a coin’s price and never expire. You never hold the coin itself, only a position on its price.
A pair like BTC/USDT:USDT reads as Bitcoin, priced in USDT, settled in USDT. USDT is a stablecoin worth about one US dollar, so your balance and results are in dollars. On the Brokers page this market shows as Futures · USDT perpetuals.
Real screen
Margin and leverage
Margin is the money a trade puts up from your balance. Leverage multiplies it into a bigger position. With 100 USDT of margin at 5×, you control a 500 USDT position.
Every move in price is then multiplied too, in both directions. That is the whole point of leverage, and the whole risk.
1×100 USDT margin, 100 USDT position. A 1% move is 1 USDT.
5×100 USDT margin, 500 USDT position. A 1% move is 5 USDT.
20×100 USDT margin, 2,000 USDT position. A 1% move is 20 USDT.
Real screen
ROI: results as a share of your margin
Results are often shown as ROI %, the result as a percentage of the margin. At 5×, a 2% move in price is 10 USDT on 100 USDT of margin: 10% ROI. Your bot’s take profit and stop loss are set in ROI %, which you will use in lesson 6.
Real screen
Liquidation
If a trade loses about as much as its margin, the exchange closes it for you. That is liquidation, and the margin is gone.
At 5×, it takes roughly a 20% move against you. At 20×, roughly 5%. The exchange’s own rules bring it a little closer than that. A stop loss closes the trade long before, at a loss you chose.
Real screen
Fees and funding
Each order pays the exchange a small fee, a percentage of the position value. On Bybit, an order that fills at once (taker) pays 0.06%, and one that waits on the book (maker) pays 0.01%. So entering a 500 USDT position at market costs 0.30 USDT.
While a perpetual position stays open, it also pays or receives funding. Funding varies by market and hour, so nobody can price it in advance. Your bot shows fees before you save it.
Real screen
Try itSee what a price move does to one tradeExample · 100 USDT margin
What happens
Position value500 USDT
Result+10 USDT
As ROI on the margin+10%
Liquidation, roughlya 20% move down
At 5×, every 1% in price is 5% of your margin. Fees and funding are not included.
Try itPick a signal to see what the bot didExample
BTC trend · SignalsBTCUSDT · Demo
WhyTraded
Inside the schedule and under the limits. The bot placed it with its own size, leverage and exits.
Rule · All rules passed
Try itPick your exchange to see exactly how it connects
OKX
Demo
Sign in on okx.com and approve TraderFrame
Live
Sign in on okx.com and approve TraderFrame
Key
Read and trade. No withdrawal
IP
Nothing to add
Markets
Perpetual futures
Don’t skip: OKX creates the TraderFrame_ key with no markets ticked. At OKX open Profile › API, edit the key, tick Spot & Margin and Perpetual futures, add all coins, save.
Try itSee what one trade commitsExample · 1,000 USDT demo balance
Each trade commits
Margin50 USDT
Position value250 USDT
Share of balance5%
Gains and losses move 5 times as fast as at 1×. The panel also shows the exchange’s cap at this leverage.
Try itTurn ROI % into a priceExample · BTC buy at 100,000
Where the exits go
Take profit price102,000
Price move to reach it+2%
Stop loss price99,000
Price move to reach it−1%
ROI is on the margin, so the price move is ROI ÷ 20. Fees and funding are not included.
Try itSend a message to an example botExample · bot trades BTCUSDT
TradingView fills in {{ticker}}, for example BINANCE:BTCUSDT.P. The prefix and .P are stripped, so it matches BTCUSDT.
Try itYour test was refused? Find the fix
What you seeOrder value is below the minimum
The exchange has a minimum order value for each pair.
The fixRaise the size or the leverage
The refusal names the minimum in USDT. Set the trade size above it.
Try itReady to automate? Tick off each one
Before your bot trades real money0 of 8 ready
Check yourselfYou open a long with 100 USDT of margin at 5×. Bitcoin rises 2%. Roughly what do you make before fees?
Not quite. Try another answer.
Common questions
No. A futures trade only puts up margin in USDT. You gain or lose on the move in price.
It makes every move bigger in both directions and brings liquidation closer. Start low while you learn, and always set a stop loss.
Spot buys the coin itself, with no leverage, and you can only profit when it rises. Futures trade its price with leverage, long or short. Most bots in this course trade futures.