Prompt engineering for SSE trading agents — the complete DSL guide
Everything you need to write effective prompts for AI trading agents on SSE.exchange. What the strategy DSL is, how Train Agent works, ready-to-use prompt templates, common mistakes, and how to climb from a red verdict chip to a green one.
Writing good prompts for a trading agent is different from writing prompts for a chatbot. You are not asking for an opinion — you are describing rules an automated system will execute with real signals, real candles, and real risk. This guide explains the SSE strategy DSL, the two ways to talk to your agent, the patterns that work, and how to iterate from a no-edge starting point to a profitable strategy.
You can read this top to bottom or jump to the section that matches your situation. Every example is copy-pasteable.
What is the SSE strategy DSL?
DSL stands for Domain-Specific Language — a small, focused vocabulary the engine understands as executable trading rules. Instead of typing free-form English and hoping the agent guesses what you meant, you describe a strategy as a structured combination of entry conditions, exit rules, and indicators. The engine translates your description, validates it against safe ranges, runs a real backtest, and only applies it if it does not make your agent worse.
You never write the DSL yourself. You write plain English; the LLM compiles it into the DSL on your behalf. But knowing what the DSL can and cannot express keeps your prompts realistic.
Allowed indicators (close-only)
| Indicator | Description | Example use |
|---|---|---|
| SMA | Simple moving average over N bars | Long-term trend ("price above SMA(200)") |
| EMA | Exponential moving average — weights recent bars more | Cross-over signals ("EMA(9) crosses EMA(21) up") |
| RSI | Relative strength index, 0–100 | Oversold ("RSI(14) below 30") or overbought |
| ROC | Rate of change over N bars | Momentum strength ("price up >2% in last 5 bars") |
| STDEV | Standard deviation of closes | Volatility filter ("only trade when STDEV is rising") |
Condition shapes the DSL accepts
- Indicator value test — "RSI(14) below 30"
- Price compared to an indicator — "close above SMA(200)"
- Indicator crossover — "EMA(9) crosses above EMA(21)"
- Price change over a window — "price up more than 1% in last 5 bars"
You can combine multiple conditions with AND (all must be true) or OR (any must be true). The engine caps complexity at a small number of conditions per block — keep your prompts focused.
Two ways to talk to your agent
SSE.exchange offers two different prompt-driven flows. Use the right one for what you want to change.
| Flow | When to use | What it changes |
|---|---|---|
| Train Agent (chat) | You want to tune an existing strategy | Adjusts parameters (e.g. stop distance, target distance, SMA windows). Cannot change the entry logic itself. |
| Build a custom strategy | You want a fundamentally new entry/exit logic | Compiles a complete DSL spec from your description. Replaces the agent's strategy entirely. |
A common mistake is using Train Agent chat to ask for a brand new strategy ("buy when RSI is low") on a Momentum-archetype agent. The chat will tune the momentum parameters but cannot add RSI to its decision logic. For that, use Build a custom strategy in the Manage panel.
The four building blocks of every good prompt
Whether you are tuning or building from scratch, a strong prompt addresses these four layers:
- ENTRY — What conditions must be true to open a position? Direction (long/short), trigger signal, optional confirmation.
- EXIT — When does the position close? Take-profit distance, stop-loss distance, optional reverse-signal triggers.
- CONTEXT — When should the agent not trade at all? Trend, volume, time-of-day filters (most are already on by default).
- RISK — How aggressive? Position size and leverage are controlled in Manage, not in the prompt.
A prompt that hits at least entry + exit gives the LLM enough to compile something executable. Adding context narrows it to higher-quality setups.
Prompt patterns that actually work
Pattern 1 — Oversold buy in an uptrend
Classic mean-reversion-with-trend-filter. High win rate when the long-term trend is intact, the dip is real (not the start of a crash), and you take profit before the next leg down.
Enter long when RSI(14) drops below 30 AND price is above SMA(200). Take profit at 3% or exit when RSI crosses above 65. Stop loss at 1.5%.Pattern 2 — Trend follow with confirmation
Don't take the first signal — wait for two things to agree before entering. Drastically cuts whipsaw losses.
Enter long when EMA(9) crosses above EMA(21) AND price is above SMA(50). Exit when EMA(9) crosses back below EMA(21), or take profit at 4%, or stop loss at 2%.Pattern 3 — Volatility expansion breakout
Wait for the market to break out of a quiet period. Often catches the start of a real move; small losses when wrong because volatility was still low at entry.
Enter long when price changes by more than 1.5% in the last 5 bars AND STDEV is rising. Take profit at 3.5%. Stop loss at 1.2%. Exit on reverse if price drops more than 1% in 3 bars.Pattern 4 — Short the rip in a downtrend
The bearish mirror of Pattern 1. Sometimes very high win rate during established bear phases.
Enter short when RSI(14) crosses above 70 AND price is below SMA(200). Take profit at 2.5%. Stop loss at 1.5%. Exit when RSI drops below 40.How to phrase a Train Agent tweak
Train Agent chat is for tuning, not rewriting. Keep prompts about ONE thing at a time so the safety-gate backtest can isolate what helped.
| Goal | Good prompt | Why |
|---|---|---|
| Reduce overtrading | "Trade less often — wait for a stronger setup before entering." | Translates cleanly to a higher entry_threshold or wider SMA gap. |
| Hold winners longer | "Let winning trades run longer before taking profit." | Increases take-profit ATR multiple. Lets trends play out. |
| Stop bleeding from noise | "Use wider stops so I don't get knocked out on small fluctuations." | Increases stop ATR multiple. Trade fewer stop-outs. |
| Be more aggressive | "Take more trades, even with weaker signals." | Lowers entry_threshold. Use carefully — expect a worse win rate. |
| Disable a filter for testing | "Stop using the volume filter for now." | Direct toggle the LLM understands. Re-enable with the opposite prompt. |
Common mistakes to avoid
- Asking for guaranteed returns. The engine refuses to make promises. Stick to mechanical descriptions ("enter long when X" not "make me 10% per week").
- Asking for indicators we don't support. Bollinger Bands, MACD, Ichimoku — these will be quietly mapped to the closest supported primitive or skipped. Use the supported list above.
- Putting too many conditions into one entry rule. The LLM caps complexity for a reason — 3-4 conditions max is the sweet spot. More conditions = fewer trades = harder to validate.
- Asking the agent to "predict" anything. The DSL is about reacting to observable conditions, not forecasting.
- Switching the entire strategy via Train Agent chat. Train tunes parameters. Build a custom strategy replaces logic.
- Iterating too fast. After each change, give the agent at least one full day of paper trades before judging. Champion/challenger needs 48h+ of forward data to vote.
The honest path from red chip to green chip
Most starting configurations earn a red No Edge verdict on the first backtest. That is expected. Real edge takes iteration.
- Run a baseline backtest on the longest window for your timeframe.
- Read which checks failed. Was it return, drawdown, win-quality, or statistical confidence? Each failure points at a different fix.
- Send ONE tweak via Train Agent (if tuning) or Build a custom strategy (if rebuilding). The safety gate will block prompts that make things worse, so you cannot accidentally regress.
- Re-run the same backtest window. Compare the verdict and the metrics grid.
- If improved, keep iterating. If still red, try a different angle (e.g. longer timeframe, different market, different strategy archetype).
- After 3-5 manual rounds, let the nightly LLM coach take over. It will propose small adjustments daily, forward-tested through champion/challenger.
Pick the right timeframe for your strategy
Timeframe is one of the highest-leverage decisions you can make in your prompt. Some strategies only have edge on certain candle resolutions.
| Timeframe | Best for | Watch out for |
|---|---|---|
| 1m | Scalping breakouts on high-vol assets | Fees eat alpha. Avoid simple SMA strategies. |
| 5m | Reactive momentum, breakout retests | Lots of noise — confirmation conditions are essential. |
| 15m | Mean reversion, balanced trading | Sweet spot for most retail strategies. |
| 1h | Trend following with patience | Best risk-adjusted returns for simple strategies. |
| 4h | Position-style swing trades | Few signals — needs long backtest window to validate. |
| 1d | Macro positioning, regime trades | Verdict statistically meaningful only over months. |
You cannot break your agent with a bad prompt
Every Train Agent prompt and every Build a custom strategy apply runs through a backtest safety gate first. If your proposed change would have done worse than your current setup on recent real data, it is rejected and your agent keeps trading the way it was. You will see a message in the chat explaining what happened.
This makes prompt iteration low-risk by design. Try things. Watch the safety messages. The agent only changes when the proposed change actually proves itself.
Quick glossary
| Term | Meaning |
|---|---|
| DSL | Domain-Specific Language — the structured grammar the engine compiles your English prompts into. |
| Verdict chip | Green "Edge survives" or red "No edge" — multi-factor judgment on whether your strategy has a real edge. |
| Safety gate | A backtest comparison run on every proposed change. Rejects changes that would make things worse. |
| Champion / Challenger | When a new tweak is queued, it runs in shadow alongside your live setup. Promoted only if it actually beats the live one over 48h+. |
| ATR | Average True Range — a volatility measure. Used by the engine for adaptive position sizing and stop distances. You don't need to mention it in prompts. |
| Tick | One scheduled evaluation cycle. Every running agent ticks every 5 minutes. |
Where to go next
- New to agents? Start with Creating your first agent.
- Want to know what the verdict chip really measures? Read Trading styles for the conceptual primer.
- Got a red verdict and want to fix it? Open Train Agent on your agent and start iterating with the patterns above.
- Have a complete strategy in mind? Open Manage → Build a custom strategy and paste one of the patterns from this article.