# Forecast Algorithm

Merchbees look at recent sales and stockout information when generating a forecast. 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.*

{% hint style="success" %}
*If you want to change the 30-day parameter or do not use stockout information please contact us via live chat.*
{% endhint %}

{% hint style="info" %}
There is one exceptional case in which we **do not use stockout information**; 'continue selling when out-of-stock products'.
{% endhint %}

### Continue selling when out-of-stock products

Since these products can be sellable independent of inventory on hand. Merchbees do not use stock-out information for these types of products. The forecast is calculated as average sales for the last 30 days for them.

### New accounts

Merchbees starts to keep inventory history when you subscribe to Enterprise+ Plan. Since we cannot see past inventory data, we assume that all products have positive inventory before you subscribe to this plan.

> :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/merchbees-low-stock-alert/homepage/forecast-and-reporting-module/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.
