# Backtesting

## First - idea

Let's say you saw a big gapper at 4:00 AM in the morning which faded hard, but you do not know if that is a one-off event or if there is a historical pattern. Here is how you can quickly put that to the test with Quanted:

1. First let's select filter parameters:
   1. First of all we select the date range - for this case it is a year worth of data
   2. Then we select the GAP% to more than 30%
   3. Price to more than 1$
   4. The pre-market high time from 4:00 AM to 4:30 AM
   5. Volume in pre-market - more than 2 million (we do not want to check the stocks with no volume because there might be simply noise rather than something statistically important).
   6. PM Fade% up to -20% (we want to check the stocks that made a big move from PM highs into the open)
2. After the criteria is set - we need to hit search and check the results:

<figure><img src="https://2637938024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdehz0tBFfj11sQ44T8uM%2Fuploads%2Fp6r6wdXefbp5sai3Hszx%2Fbacktest.png?alt=media&#x26;token=e92b1e4f-c705-4b55-8296-0db44002ff3e" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2637938024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdehz0tBFfj11sQ44T8uM%2Fuploads%2FHqu3g7dU02vSapkqbEDv%2Fbacktesting%20resutls.png?alt=media&#x26;token=482a4df1-0793-4865-bf42-756d2b6a3870" alt=""><figcaption></figcaption></figure>

Now we are presented will all the stocks that gapped more than 30% this year and made a pre market highs at 4:00-4:30 AM. The system shows us all the relevant statistics and now you can investigate whether this particular setup has significance for you or not. You can also view charts and check out the patterns of those filtered stocks:

<figure><img src="https://2637938024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdehz0tBFfj11sQ44T8uM%2Fuploads%2FSsSl5CcO8CY2XMSRrKii%2Fcharts%20setups.png?alt=media&#x26;token=df422b12-c6ee-4bb8-be71-49949a6f0246" alt=""><figcaption></figcaption></figure>


---

# 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://quanted.gitbook.io/docs/features/backtesting.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.
