EnterLong()
Generates a Buy Market order to enter a long position.
Single Market Strategy
Parameters
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
Parameters
Example
Last updated