# IndicatorsMarketplace

To enable you to use various kinds of algorithms and indicators from Signals Indicators Marketplace, you need an object which allows you to access those algorithms inside your strategies. That is what the `IndicatorsMarketplace` object does in the `Setup` method of each strategy.

## **Select indicators from the Indicators Marketplace**

Select indicators and their version (Signals Framework supports versioning of algorithms created by developers) from the Indicators dropdown in the sidebar. In the background, the framework will automatically reference the selected algorithm in your strategy and add a `using` statement into your code in the code editor.

Selected indicators will be accessible through the `IndicatorsMarketplace indicators` object in the `Setup` method and intellisense will automatically start suggesting all the indicators which you have selected via the dropdown.

![Selecting Simple Moving Average indicator from the Indicators dropdown.](/files/-LnCEBIDbp0bXixsSmU9)

## **Apply indicator on a data series**

### **OnSeries Method**

Definition of an indicator is not complete without defining which data series you want to use it on. The `OnSeries` method makes this definition easy. Some indicators need a stream of doubles, while others are processing Bars. That's why the `OnSeries` method input parameter varies, based on the type of indicator.

#### Parameters

| Name     | Type                 | Description                                  |
| -------- | -------------------- | -------------------------------------------- |
| `series` | IDataSerires\<TData> | Data series used as input for the indicator. |

**Example**

{% tabs %}
{% tab title="Basic example" %}

```csharp
// Apply SMA indicator on close values of a 24 hours bars data series
// with SMA period of 14.
sma = indicators.SMA(14).OnSeries(dailyBars.Close);
```

{% endtab %}

{% tab title="Complete example" %}

```csharp
using Signals.DataSeries.Bars;
using Signals.Framework;
using Signals.Indicators.SMA;

public class MyStrategy : SingleMarketStrategy
{
    private Bars dailyBars;
    private SMA sma;

    public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators)
    {
        dailyBars = data.Bars(BarPeriodType.Day, 1).WithOffset(2);
        sma = indicators.SMA(14).OnSeries(dailyBars.Close);
    }

    public override void RegisterActions()
    {
        OnUpdateOf(dailyBars).Do(() =>
        {
            // Prints the current SMA value
            Log("The current SMA value is " + sma.Value.ToString());
        });
    }
}
```

{% endtab %}
{% endtabs %}

### Keep Method

Very often in your strategy logic, you want to make your trading decision based not only on the current indicator value but also on its historical value. Using the `Keep` method, you can define how many historical values should be stored in an indicator. By default, indicators only store a  value for the current bar.

#### Parameters

| Name            | Type | Description                                                |
| --------------- | ---- | ---------------------------------------------------------- |
| `requiredCount` | int  | The number of historical values the indicator should keep. |

**Example**

Suppose you need to know what the value of an SMA indicator was 10 bars in the past, you can simply set up an indicator using the `Keep`method with a parameter value of 10.

{% tabs %}
{% tab title="Basic example" %}

```csharp
// Apply SMA indicator on close values of a 24 hours bars data series
// with SMA period of 14 and keep a retrospective overview of 10 bars
// into the past.
sma = indicators.SMA(14).Keep(10).OnSeries(dailyBars.Close);
```

{% endtab %}

{% tab title="Complete example" %}

```csharp
using Signals.DataSeries.Bars;
using Signals.Framework;
using Signals.Indicators.SMA;

public class MyStrategy : SingleMarketStrategy
{
    private Bars dailyBars;
    private SMA sma;

    public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators)
    {
        dailyBars = data.Bars(BarPeriodType.Day, 1).WithOffset(50);
        sma = indicators.SMA(14).Keep(10).OnSeries(dailyBars.Close);
    }

    public override void RegisterActions()
    {
        OnUpdateOf(dailyBars).Do(() =>
        {
            // Prints the current SMA value
            Log("The current SMA value is " + sma.Value.ToString());

            // Prints the previous SMA value
            Log("The previous SMA value is " + sma.Values[1].ToString());
        });
    }
}
```

{% endtab %}
{% endtabs %}

&#x20;


---

# 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://help.signals.network/framework-documentation/untitled/methods/setup/indicatorsmarketplace.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.
