Generates a Buy Market order to enter a long position.
Single Market Strategy
Parameters
Name
Type
Description
label
string
Optional parameter which can be used for labeling the signal generated when an order is triggered.
The browser app doesn't show the custom labels in the UI at the moment. It will be updated in the future release.
Example
// Generates a Buy Market order to enter a long position
EnterLong();
using Signals.DataSeries.Bars;
using Signals.Framework;
using Signals.Indicators.SMA;
public class MyStrategy : SingleMarketStrategy
{
private Bars hourlyBars;
private SMA smaSlow;
private SMA smaFast;
private int fast = 10;
private int slow = 25;
public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators)
{
hourlyBars = data.Bars(BarPeriodType.Hour, 1).WithOffset(25);
smaSlow = indicators.SMA(slow).OnSeries(hourlyBars.Close);
smaFast = indicators.SMA(fast).OnSeries(hourlyBars.Close);
}
public override void RegisterActions()
{
OnUpdateOf(hourlyBars).Do(() =>
{
if (smaFast.Value > smaSlow.Value && !Position.InPosition)
{
// Generates a buy market order to enter a long position
EnterLong();
}
else if (smaFast.Value < smaSlow.Value && Position.InPosition)
{
ExitLong();
}
});
}
}
Multi Market Strategy
In MMS you need to specify the market on which to execute the order as the very first argument.