> For the complete documentation index, see [llms.txt](https://thequantsciences-suite.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thequantsciences-suite.gitbook.io/documentation/thequantscience.io/open-source/premium-backtesting/grid-spot-trading-algorithm-v2.md).

# Grid Spot Trading Algorithm V2

This backtesting software analyzes the performance of the proprietary strategy developed by our team and released as open source as a contribution to the community.

**Strategy type:** manually executable

**Applicability:** stocks, indices, forex, cryptocurrencies, ETFs, etc.

## Strategy

The analyzed strategy is a manually executable long-only strategy, based on a grid algorithm that allows averaging the entry price across 5 different levels and closing trades once the profit is achieved.

## Accumulation

The entry price, located in the center, divides the grid into two parts. When the price drops below the central price and enters the red territory, the algorithm buys a fraction each time the price breaks a red level downwards **\[A]**.

<figure><img src="https://3368670033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQA5TREj5G7T0pH3ZeTAz%2Fuploads%2FJw0NxX8kSSVTmpgPH030%2FSchermata%202024-01-06%20alle%2013.13.39.png?alt=media&amp;token=888d827d-be47-44c8-981a-415ab8796caf" alt=""><figcaption></figcaption></figure>

During the accumulation phase, the algorithm invests at each level an amount equal to a **Lot**.

***Lot = Current Capital / 5***&#x20;

*Example: If the current capital is $10,000.00, Lot will be equal to $2,000.00.*

## Closing trades

All previously opened positions are closed simultaneously at a single level within the green area **\[B]**. The sell level can be modified from the user interface **\[C]**.

<figure><img src="https://3368670033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQA5TREj5G7T0pH3ZeTAz%2Fuploads%2F7aFZTokNcl9AX5OMDKjj%2FSchermata%202024-01-06%20alle%2013.17.01.png?alt=media&amp;token=c29a40ba-286c-4134-be80-6da45b9be1ec" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3368670033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQA5TREj5G7T0pH3ZeTAz%2Fuploads%2Fe2OivhuhMmrZYvf4Kf9v%2FSchermata%202024-01-06%20alle%2013.17.52.png?alt=media&amp;token=fa547831-d6d8-46c7-99ca-f1f645103469" alt=""><figcaption></figcaption></figure>
