Define Variables

Define variables to be used in your strategy.

First of all, let’s define a variable inside the strategy. We want to use an SMA indicator within our strategy. To add it, just select it from the left panel of the editor under the Indicators menu and you will notice a using statement, using Signals.Indicators.SMA, is automatically added into your code. In the background, Signals framework references a binary file of the SMA algorithm from your new strategy.

Except for the two SMA indicators, we will define a Bars variable, which will reference a data stream which consists of hourly bars. The code, after we define all variables, will look like this:

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

public class MyStrategy : SingleMarketStrategy
{
  private Bars hourlyBars;
  private SMA smaSlow;
  private SMA smaFast;
  
  public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators)
  {
    // method for setting data and indicators
  }
  
  public override void RegisterActions()
  {
    // method for registering actions over the data e.g. your strategy logic
  }
}

Last updated