# Trading bots

**Trading bots** rely on active position management, with **well-defined entry and exit rules**. They let you exploit market opportunities across different timeframes, from scalping to swing trading.

On this page, you'll find **concrete examples** to help you write your own descriptions.

{% hint style="success" %}
A good way to write clear rules is to ask yourself:

"If I were teaching my strategy to someone else using only these rules, would they understand everything or would they have questions on unclear aspects?".

If the answer is YES, your rules are clear and you can create your agent.\
If the answer is NO, you should clarify them to avoid any ambiguity.
{% endhint %}

## Examples

<mark style="color:purple;">Example #1</mark>

**Entry rules:** On a 4-hour chart, buy when the 5-period moving average crosses above the 10-period moving average.

**Exit rules:** Place a 50% stop-loss at 2 ATR. Set up a 50% stop-loss if the moving average crosses below the 10-period moving average. Take a partial profit of 40% at 1 ATR. Take a partial profit of 60% at 2 ATR.

***

<mark style="color:purple;">Example #2</mark>

**Entry rules:** On a 1-hour chart, enter long when the MACD is bullish for 5 consecutive candles.

**Exit rules:** Exit 50% of the position when the MACD turns from positive to negative and the other 50% when the EMA 9 crosses below the EMA 21.

***

<mark style="color:purple;">Example #3</mark>

**Entry rules:** On a 15-minute timeframe, buy when the MACD line crosses above the signal line and the relative strength index is above 50. Sell when the MACD line crosses below the signal line and the RSI is below 50.

**Exit rules:** Close when the RSI drops below 50 for a buy, or rises above 50 for a sell.

***

<mark style="color:purple;">Example #4</mark>

**Entry rules:** When the Tenkan is above the Kijun for at least 10 periods, we buy on the 2-hour chart. The reverse for selling.

**Exit rules:** Sell when there's a bearish crossover between Tenkan and Kijun. The reverse for sells.

***

<mark style="color:purple;">Example #5</mark>

**Entry rules:** When the average ADX of the last 10 periods crosses the average ADX of the last 20 periods, we buy. The opposite for selling. All on a 4-hour chart.

**Exit rules:** SL at 3 times the ATR distance. TP at 2.15 R.

***

<mark style="color:purple;">Example #6</mark>

**Entry rules:** Use the 4-hour chart, the 30-minute chart, and the 50 and 200 simple moving averages on each timeframe. To buy, the price must be above the 200 moving average on the 4H, and the 50 moving average must cross the 200 moving average on the 30M.

**Exit rules:** The trade is closed when the reverse crossover occurs between the 50 and 200 moving averages on the 30M chart.

***

<mark style="color:purple;">Example #7</mark>

**Entry rules:** On an H1 chart, wait for the price to break and close above the Ichimoku Cloud. Then wait for the crossover where the Conversion Line (Tenkan) goes above the Base Line (Kijun). Buy at the open of the next candle after the crossover.

**Exit rules:** Place a stop-loss below the breakout candle. Take profits when the Conversion Line crosses below the Base Line.

***

<mark style="color:purple;">Example #8</mark>

**Entry rules:** If there's a bearish RSI divergence on the 4-hour chart, and at the same time a regular bearish RSI divergence on the 30-minute chart, then sell.

**Exit rules:** SL on the high of the 4H candle that shows the divergence. TP when the RSI drops below 50.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.obside.com/agents/create-an-agent/examples/trading.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
