# Signal duration rule

In the previous example, we have seen how to create a signal. But you also sometimes need to determine for how long the signal will exist.

If your strategy only has 1 signal, then you'll not need the signal duration feature. Because as soon as your signal is triggered, your strategy will immediatly execute the order.&#x20;

***

However, if your strategy requires 2 longs signals to execute an order, you might need a signal duration rule to meet the requirements.

\
It will depend of your type of signal trigger. For example, if you create a long signal with the "cross signal" feature, this will be activated only during the next candle. That can be a very short period of time and you might never meet the second long signal at the same time.

&#x20;

***

\
If you have a long signal from a "in zone" trigger, your signal might be longer, since the indicator can stay in that zone for many more candles/time, which makes things easier to meet others signals at the same time and then trade.

Click on "*add a new signal duration rule*" to add an existence time of your signal once it is created. \
You can either choose a duration time, like 1x1 hour candle or let the signal be activated until you trigger another specific signal. See next examples.&#x20;

***

*Ex 1: \[There is a minimum of 2 long signals]* \
*We want to open a long position only if we are triggering 2 longs signals at the same time.*

<figure><img src="https://793384675-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsQezxfp9oB9jrccv5OA4%2Fuploads%2Fob90JEklFzuxuQx6qAH0%2Fimage.png?alt=media&#x26;token=300b01bc-8074-4b70-aee0-b5132274d060" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://793384675-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsQezxfp9oB9jrccv5OA4%2Fuploads%2F43DgNbehmgtBs9HIpyuR%2Fimage.png?alt=media&#x26;token=9f299dbd-3c2c-451c-aa68-634437a979b3" alt="" width="563"><figcaption></figcaption></figure>

*In that example, we want the RSI to cross up the level 20 and at the same time the Stochastic to be in the zone \[0;40] to execute a long order. The long signal from the RSI will be activated during 1 hour after it has been triggered. The long signal from the Stochastic will be activated only when it is in the \[0;40] zone.*

*-> If the Stochastic is in the zone at 35, and then later the RSI cross up the level 20, the bot will open a long position (the duration rule here doesn't matter).*

*-> If the RSI cross up the level 20 and then 1 hour later the Stochastic is still not in the zone \[0;40], the bot will not open any positon.*

*-> If the RSI cross up the level 20 and 45 minutes after the Stochastic just entered the zone, the bot will open a long position. That long is possible because the RSI signal is activated during 1 hour.* \
*Without this duration rule, the long signal would only be activated for 15 minutes (i.e. the next candle of the same period), so there would be no trade.*

<figure><img src="https://793384675-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsQezxfp9oB9jrccv5OA4%2Fuploads%2FcveCcWxyA1grYyXFxqEQ%2Fimage.png?alt=media&#x26;token=6e660936-0252-491c-9589-c652d59e9afb" alt="" width="314"><figcaption></figcaption></figure>

It is also possible to create the signal not only for a specific time, but until another signal is triggered.&#x20;

\
In this example, as soon as a stop signal is triggered, the long signal is canceled.

<figure><img src="https://793384675-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsQezxfp9oB9jrccv5OA4%2Fuploads%2Fm2W9RoKxetnlSoVBb4Cp%2Fimage.png?alt=media&#x26;token=d2168e28-a4fd-4e9f-8195-37ff7b8ec2f0" alt="" width="375"><figcaption></figcaption></figure>

Another possibility, is to delay the activation of the long signal.\
In this example, we wait for 1 hour before placing a long signal.


---

# 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.runbot.io/strategy-boxes/indicators-box/signal-duration-rule.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.
