Writing conditional orders
A conditional order is a trading task that waits for a price or indicator condition and then places the order you described. This page covers the wording rules that decide when it fires and what it attaches to the order.
Find it at: the Agent page — type the order in chat, then check the Monitor Order Preview card before you confirm. For the task types in general, see Tasks and strategies.
1. "Above" and "crosses above" are different
This is the most common reason a conditional order fires too early or never fires.
| You write | Alphio AI reads it as | When it fires |
|---|---|---|
| "when the price is above EMA 200" / "breaks $70,000" / "drops below the 50 MA" | A state: price > line | At the first check where it's true. If it's already true when you confirm, it fires within minutes. |
| "when the price crosses above EMA 200" | An event: the previous candle was at or below the line, and the current candle is above it | Only on the candle where the cross happens. If the price is already above the line, it waits for the price to drop back below and cross again. |
| "when BTC reaches $70,000" | A price level, from whichever side the price is on now | When the price gets to that level, rising or falling |
Several crosses joined with "and" fire on the first candle where all of them are true. "Buy when the price crosses above EMA 20, 50 and 200" fires on the candle that crosses the last of the three lines while the price is already above the other two — the crosses don't have to happen on the same candle. If the price is already above all three when you confirm, the task waits for it to drop below at least one line and then get back above all of them.
If you want to buy as soon as the price is above the lines, including right away, use "above" instead:
- "Buy when the M15 close is above EMA 20, 50 and 200" — fires as soon as the price is above all three, including right away if it already is.
- "Buy when the M15 close crosses above EMA 20, 50 and 200" — fires on the first candle where it gets above all three.
2. What a condition can watch
| Item | What works |
|---|---|
| Price | A price level, a percentage move (from the previous close for stocks, from 24 hours ago for crypto), a percentage move within one candle, new highs or lows over 5 / 20 / 60 / 250 candles |
| Indicators | RSI, MA, EMA, WMA, MACD (line, signal, histogram), Bollinger Bands (upper, middle, lower), KDJ, ATR, ADX, +DI / −DI, CCI, OBV, VWAP — with the periods you name, e.g. "RSI(7)", "EMA 50" |
| Candle intervals | 5m, 15m, 30m, 1h, 2h, 1d, 1w. There is no 1-minute or 4-hour interval. If you don't name one, Alphio AI uses daily candles. |
| Combining | Join conditions with "and" / "or", e.g. "RSI(14) on 1h below 30 and the price above the daily 200 MA". |
| Assets | US stocks and ETFs, and crypto on Hyperliquid — perpetuals (including markets such as xyz:GOLD and xyz:JPY) and spot. |
All parts of one condition are measured on the same asset. The asset you watch can differ from the asset you trade: "Sell my BOME if SPY drops 1.5% today" watches SPY and trades BOME.
3. Size, leverage, and margin
- Size — a dollar amount ("$15", "50 USDC") or a quantity ("0.01 BTC", "10 shares"). You can also size by what you hold — "close my whole position", "sell half" — and Alphio AI resolves it against your live balance and positions when the task fires.
- Leverage — say it if you want it ("40x"). If you don't, a new Hyperliquid position opens at 1x, and an asset you already hold keeps that position's leverage.
- Margin mode — cross by default on standard Hyperliquid perpetuals. Markets with a prefix such as xyz:JPY or xyz:GOLD only support isolated margin, so they always use isolated.
4. Stop loss and take profit
You can add a stop loss and a take profit in the same sentence as the condition. They are attached to the order the task places and become active once that order fills.
| Works | Example |
|---|---|
| A fixed price | "…stop loss at 157.50, take profit at 159.20" |
| A percentage from the entry price | "…stop loss 2%, take profit 5%" — for a long, a 2% stop sits 2% below the entry price; for a short, 2% above |
Rules:
- Hyperliquid perpetuals only. On stocks, ETFs and crypto spot, a conditional order can't carry a stop loss or take profit — set up a separate conditional order to close the position instead.
- One stop loss and one take profit per order, each as either a price or a percentage.
- Not supported: exits based on an indicator (for example "exit when RSI goes above 70" or "stop loss at 1 ATR"), trailing stops, and moving the stop after a target is hit (for example "move the stop to breakeven after TP1"). If a stop loss or take profit isn't on the preview card, it won't be attached — check before you confirm.
Using ATR as a stop distance: convert it to a percentage first. Read the current ATR on your chart for the interval you trade, divide it by the price, and use that as the stop. For example, if the 15m ATR is 0.097 and the price is 157.9, 1 ATR is about 0.06%, so write "stop loss 0.06%". Keep in mind that at high leverage a stop this close is easily reached by normal price movement.
5. How often it fires and how long it lasts
- Once by default. After it fires, the task finishes. To repeat, say so ("every time…", "up to 5 times"); the maximum executions are shown on the card.
- At most once per day, even when it can repeat. A day is counted in UTC for crypto and in US Eastern time for stocks.
- Watches for 60 days by default. You can ask for a different duration; it's shown on the card as the maximum duration.
- Checked continuously, while the task is running. The fill price can differ from the level in your condition if the price moves quickly.
6. Example prompts
| Instead of | Write |
|---|---|
| "Long ETH, stop loss at 1 ATR" | "Long $100 ETH 10x when the 1h RSI(14) drops below 30, stop loss 1.5%, take profit 4%" |
| "Sell when the trend turns" | "Close my SOL position when the daily close drops below the 50 EMA" |
| "Buy BTC on the 4h golden cross" | "Buy $200 BTC when the 2h EMA 9 crosses above EMA 21" |
Before you confirm, read the trigger, size, leverage, stop loss and take profit on the Monitor Order Preview card.
This page is available as plain Markdown at https://alphio.ai/docs/agentic-trading/writing-conditional-orders.md. An index of every page, with a one-line summary each, is at https://alphio.ai/docs/llms.txt.