# Forecast Algorithm

Merchbees look at recent sales and stockout information when generating a forecast.&#x20;

By default, we use the last 30 days **when the product had available inventory** to calculate the sales velocity.

1. We look at sales and stock over the last 30 days.
2. If the product went out of stock during the last 30 days, we would look at the nearest 30 days **when the stock was available** in 90 days to calculate the sales velocity.
3. If the product had less than 30 in-stock days, the forecast is calculated as total sales/ number of in-stock days. *Note: if the number of in-stock days is <= 7,  we divide total sales over 7 days by default.*

<figure><img src="/files/y2jqB5gy7hbeRZ85AAnf" alt="" width="362"><figcaption></figcaption></figure>

### **Parameters**

#### **- Compute forecast using orders in the last**

If you want to include more than 30 days in the forecast calculation, you can choose the 60 or 90 days options on the [Settings](https://merchbees.com/forecast-replenishment/setting) page.

<div align="left"><figure><img src="/files/n08Bjjx8OWussUwpYkyp" alt=""><figcaption></figcaption></figure></div>

#### **- Use stockout information**

By default, when calculating the forecast, we do not include the days the product was out of stock since the product cannot make sales on those days.&#x20;

By excluding stockout days, we base the forecast on the sales performance of the product during in-stock days. Not including stockout days in the forecast algorithm significantly improves and affects forecast accuracy. However, if you do not want to use stockout information and want to include all days in the forecast algorithm, you can uncheck the "Use stockout information" checkbox.

{% hint style="warning" %}
**Exclusion**\
There is one exceptional case in which we **do not use stockout information**; 'continue selling when out-of-stock products'. Since these products can be sold independently of inventory on hand, Merchbees do not use stockout information for these types of products.
{% endhint %}

{% hint style="info" %}
**New Accounts**

Merchbees starts to keep inventory history during the free trial period and continues to do so if you subscribe to any Bee Forecast & Replenishment plan. Since we cannot see past inventory data, we assume that all products had positive inventory before you installed the application.
{% endhint %}

#### **- Eliminate outlier sales**

In the forecast algorithm, outlier adjustment is done if the "Eliminate outlier sales" checkbox is selected. If you want to include outlier sales in the forecast, you can uncheck this checkbox.

[What are outlier sales and how do they affect the forecast algorithm?](/bee-forecast-and-replenishment/homepage/forecast-and-replenishment-calculations/outlier-sales.md)

> :wave: If you have a different need for a forecast, please don't hesitate to contact us! We are always here to help!\
> You can say hello with live chat on [merchbees.com](https://merchbees.com/) or send an email to <support@merchbees.com>.


---

# 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.merchbees.com/bee-forecast-and-replenishment/homepage/forecast-and-replenishment-calculations/forecast-algorithm.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.
