Class Strategy
- Namespace
- Balsam
- Assembly
- Balsam.Backtester.dll
An abstract base class that exposes common methods and properties for testing trading strategies.
public abstract class Strategy : SeriesManager, IStrategy
- Inheritance
-
Strategy
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
AllowMultiplePositions
Gets/sets whether multiple simultaneous positions can be opened for a single symbol. Default is false.
protected bool AllowMultiplePositions { get; set; }
Property Value
AutoReverseOnOppositeEntry
Gets/sets whether the strategy will automatically reverse an existing position if there is an entry signal on the opposite side.
protected bool AutoReverseOnOppositeEntry { get; set; }
Property Value
BarsSinceEntry
Gets the number of bars since entry for the current position or -1 if there is no open position.
protected int BarsSinceEntry { get; }
Property Value
BarsSinceExit
Gets the number of bars that have elapsed since the last position was closed or -1 if the system hasn't traded yet.
protected int BarsSinceExit { get; }
Property Value
ClosedPositions
Gets a collection of all closed positions.
public PositionCollection ClosedPositions { get; }
Property Value
CurrentPosition
Gets the current open position or null if there are no open positions. When AllowMultiplePositions is true, reference the OpenPositions collection instead.
protected Position CurrentPosition { get; }
Property Value
DataStore
Gets the underlying data store used to collect and possibly persist all strategy generated trade information.
public DataStoreBase DataStore { get; set; }
Property Value
EnforceUniqueSignalNames
Gets/sets whether trades must have unique signal names.
protected bool EnforceUniqueSignalNames { get; set; }
Property Value
EntryDate
Gets the last date a position was opened.
protected DateTime EntryDate { get; }
Property Value
EntryPrice
Gets the average entry price or NaN if there is no current position.
protected double EntryPrice { get; }
Property Value
ExitDate
Gets the last date a position was closed.
protected DateTime ExitDate { get; }
Property Value
ExitPrice
Gets the last price on which an open position was reduced or if no open positions, the average exit price of the last closed position.
protected double ExitPrice { get; }
Property Value
IsFirstBar
Gets whether the current bar is the first valid bar being tested.
protected bool IsFirstBar { get; }
Property Value
IsLastBar
Gets whether the current bar is the last valid bar being tested.
protected bool IsLastBar { get; }
Property Value
MarketPosition
Gets the current market position.
protected PositionSide MarketPosition { get; }
Property Value
MoneyManager
Gets/sets the money manager associated with this strategy.
public MoneyManager MoneyManager { get; set; }
Property Value
MultiplierSize
Gets/sets how muliplier trade size is calculated.
protected MultiplierSizeCalculation MultiplierSize { get; set; }
Property Value
Name
Gets/sets name of the trading strategy.
public string Name { get; set; }
Property Value
OpenPositions
Gets/sets a collection of all positions currently open.
public PositionCollection OpenPositions { get; set; }
Property Value
OrderHandler
Gets the order handler.
public OrderHandler OrderHandler { get; }
Property Value
PendingOrders
Gets a collection of pending orders that have been queued for execution the following bar.
public OrderCollection PendingOrders { get; }
Property Value
Results
Gets the results of the strategy backtest.
public TradeStats Results { get; }
Property Value
SimulationMode
Gets/sets the simulation mode.
public SimulationMode SimulationMode { get; set; }
Property Value
SimulationOptions
Gets/sets options to control simulation and order handling rules.
public SimulationOptions SimulationOptions { get; set; }
Property Value
StrategyVariables
Gets a collection of global variables assigned to this strategy.
protected VariableDictionary StrategyVariables { get; }
Property Value
Tag
Gets/sets a convenience field for the user to store any arbitrary object or identifying information.
public object Tag { get; set; }
Property Value
TransactionCosts
Gets/sets the transaction cost model applied to this strategy.
public TransactionCostModel TransactionCosts { get; set; }
Property Value
Methods
Buy()
Submits a buy market order for the primary series.
protected void Buy()
Buy(BarSeries)
Submits a buy market order for the specified series.
protected void Buy(BarSeries series)
Parameters
series
BarSeries
Buy(BarSeries, string)
Submits a buy market order for the specified series using the specified signal name.
protected void Buy(BarSeries series, string signalName)
Parameters
Buy(string)
Submits a buy market order for the primary series using the specified signal name.
protected void Buy(string signalName)
Parameters
signalName
string
BuyClose()
Submits a buy order MOC on the current bar for the primary series.
protected void BuyClose()
BuyClose(BarSeries)
Submits a buy order MOC on the current bar for the specified series.
protected void BuyClose(BarSeries series)
Parameters
series
BarSeries
BuyClose(BarSeries, string)
Submits a buy order MOC on the current bar for the specified series using the specified signal name.
protected void BuyClose(BarSeries series, string signalName)
Parameters
BuyClose(string)
Submits a buy order MOC on the current bar for the primary series using the specified signal name.
protected void BuyClose(string signalName)
Parameters
signalName
string
BuyLimit(BarSeries, double)
Submits a buy limit order using the specified series and limit price.
protected void BuyLimit(BarSeries series, double limitPrice)
Parameters
BuyLimit(BarSeries, double, string)
Submits a buy limit order using the specified parameters.
protected void BuyLimit(BarSeries series, double limitPrice, string signalName)
Parameters
BuyLimit(double)
Submits a buy limit order using the specified limit price.
protected void BuyLimit(double limitPrice)
Parameters
limitPrice
double
BuyLimit(double, string)
Submits a buy limit order using the specified limit price and signal name.
protected void BuyLimit(double limitPrice, string signalName)
Parameters
BuyPair(BarSeries, BarSeries)
Buys the primary series and shorts the secondary series against it.
protected void BuyPair(BarSeries primary, BarSeries secondary)
Parameters
BuyPair(BarSeries, BarSeries, string)
Buys the primary series and shorts the secondary series against it using the specified signal name.
protected void BuyPair(BarSeries primary, BarSeries secondary, string signalName)
Parameters
BuyPairClose(BarSeries, BarSeries)
Buys the primary series and shorts the secondary series against it MOC.
protected void BuyPairClose(BarSeries primary, BarSeries secondary)
Parameters
BuyPairClose(BarSeries, BarSeries, string)
Buys the primary series and shorts the secondary series against it MOC using the specified signal name.
protected void BuyPairClose(BarSeries primary, BarSeries secondary, string signalName)
Parameters
BuyStop(BarSeries, double)
Submits a buy stop order using the specified series and stop price.
protected void BuyStop(BarSeries series, double stopPrice)
Parameters
BuyStop(BarSeries, double, string)
Submits a buy stop order using the specified parameters.
protected void BuyStop(BarSeries series, double stopPrice, string signalName)
Parameters
BuyStop(double)
Submits a buy stop order using the specified stop price.
protected void BuyStop(double stopPrice)
Parameters
stopPrice
double
BuyStop(double, string)
Submits a buy stop order using the specified stop price and signal name.
protected void BuyStop(double stopPrice, string signalName)
Parameters
CancelOrder(Order)
Cancels the specified order.
protected void CancelOrder(Order order)
Parameters
order
Order
CancelOrder(Order, string)
Cancels the specified order for the reason indicated.
protected void CancelOrder(Order order, string reason)
Parameters
CancelPendingOrders()
Cancels pending orders for the primary series or all pending orders if the primary series is null.
protected void CancelPendingOrders()
Clear()
Clears all positions, pending orders, order queue, and DataStore if set.
public void Clear()
Cover()
Submits a market order to cover the current position.
protected void Cover()
Cover(Position)
Submits a market order to cover the specified position.
protected void Cover(Position position)
Parameters
position
Position
Cover(Position, string)
Submits a market order to cover the specified position using the specified signal name.
protected void Cover(Position position, string signalName)
Parameters
Cover(string)
Submits a market order to cover the current position using the specified signal name.
protected void Cover(string signalName)
Parameters
signalName
string
CoverClose()
Submits a cover order MOC on the current bar for the current position.
protected void CoverClose()
CoverClose(Position)
Submits a cover order MOC on the current bar for the specified position.
protected void CoverClose(Position position)
Parameters
position
Position
CoverClose(Position, string)
Submits a cover order MOC on the current bar for the specified position using the specified signal name.
protected void CoverClose(Position position, string signalName)
Parameters
CoverClose(string)
Submits a cover order MOC on the current bar for the current position using the specified signal name.
protected void CoverClose(string signalName)
Parameters
signalName
string
CoverLimit(Position, double)
Submits a cover limit order for the specified position using the specified limit price.
protected void CoverLimit(Position position, double limitPrice)
Parameters
CoverLimit(Position, double, string)
Submits a cover limit order using the specified parameters.
protected void CoverLimit(Position position, double limitPrice, string signalName)
Parameters
CoverLimit(double)
Submits a cover limit order for the current position using the specified limit price.
protected void CoverLimit(double limitPrice)
Parameters
limitPrice
double
CoverLimit(double, string)
Submits a cover limit order for the current position using the specified limit price and signal name.
protected void CoverLimit(double limitPrice, string signalName)
Parameters
CoverStop(Position, double)
Submits a cover stop order for the specified position using the specified stop price.
protected void CoverStop(Position position, double stopPrice)
Parameters
CoverStop(Position, double, string)
Submits a cover stop order using the specified parameters.
protected void CoverStop(Position position, double stopPrice, string signalName)
Parameters
CoverStop(double)
Submits a cover stop order for the current position using the specified stop price.
protected void CoverStop(double stopPrice)
Parameters
stopPrice
double
CoverStop(double, string)
Submits a cover stop order for the current position using the specified stop price and signal name.
protected void CoverStop(double stopPrice, string signalName)
Parameters
ExitAtLimit(Position, double)
Exits the specified position at the specified limit price.
protected void ExitAtLimit(Position position, double limitPrice)
Parameters
ExitAtLimit(Position, double, string)
Exits the specified position at a limit using specified signal name.
protected void ExitAtLimit(Position position, double limitPrice, string signalName)
Parameters
ExitAtLimit(double)
Exits the current position at the specified limit price.
protected void ExitAtLimit(double limitPrice)
Parameters
limitPrice
double
ExitAtLimit(double, string)
Exits the current position at the specified limit price using the specified signal name.
protected void ExitAtLimit(double limitPrice, string signalName)
Parameters
ExitAtMarket()
Exits the current position at the market. If current position is null, no order will be submitted.
protected void ExitAtMarket()
ExitAtMarket(Position)
Exits the specified position at the market.
protected void ExitAtMarket(Position position)
Parameters
position
Position
ExitAtMarket(Position, string)
Exits the specified position at the market using the specified signal name.
protected void ExitAtMarket(Position position, string signalName)
Parameters
ExitAtMarket(string)
Exits the current position at the market using the specified signal name. If current position is null, no order will be submitted.
protected void ExitAtMarket(string signalName)
Parameters
signalName
string
ExitAtTarget()
Exits the current position at the target price found in the position's Target property. If current position is null, no order will be submitted.
protected void ExitAtTarget()
ExitAtTarget(Position)
Exits the specified position at the limit found in the position's Target property.
protected void ExitAtTarget(Position position)
Parameters
position
Position
ExitAtTarget(Position, string)
Exits the specified position at the limit found in the position's Target property using the specified signal name.
protected void ExitAtTarget(Position position, string signalName)
Parameters
ExitAtTarget(string)
Exits the current position at the target price found in the position's Target property using the specified signal name. If current position is null, no order will be submitted.
protected void ExitAtTarget(string signalName)
Parameters
signalName
string
ExitOnClose()
Exits the current position MOC on the same bar. If current position is null, no order will be submitted. Only available from backtesting.
protected void ExitOnClose()
ExitOnClose(Position)
Exits the specified position MOC on the same bar. Only available from backtesting.
protected void ExitOnClose(Position position)
Parameters
position
Position
ExitOnClose(Position, string)
Exits the specified position MOC on the same bar using the specified signal name. Only available from backtesting.
protected void ExitOnClose(Position position, string signalName)
Parameters
ExitOnClose(string)
Exits the current position MOC on the same bar using the specified signal name. If current position is null, no order will be submitted. Only available from backtesting.
protected void ExitOnClose(string signalName)
Parameters
signalName
string
ExitOnHorizon(int)
Exits MOC if CurrentPosition.BarsSinceEntry is greater than or equal to the specified horizon.
protected void ExitOnHorizon(int horizon)
Parameters
horizon
int
ExitOnHorizon(int, string)
Exits MOC using the specified signal name if CurrentPosition.BarsSinceEntry is greater than or equal to the specified horizon.
protected void ExitOnHorizon(int horizon, string signalName)
Parameters
ExitOnStop()
Exits the current position at the stop price found in the position's Stop property.
protected void ExitOnStop()
ExitOnStop(Position)
Exits the specified position at the stop price found in the position's Stop property.
protected void ExitOnStop(Position position)
Parameters
position
Position
ExitOnStop(Position, string)
Exits the specified position at the stop price found in the position's Stop property using the specified signal name.
protected void ExitOnStop(Position position, string signalName)
Parameters
ExitOnStop(string)
Exits the current position at the stop price found in the position's Stop property using the specified signal name.
protected void ExitOnStop(string signalName)
Parameters
signalName
string
GetEventMarkers()
Returns a read-only collection of event markers assuming SnapEvent has been called from within the strategy.
public ReadOnlyCollection<EventMarker> GetEventMarkers()
Returns
GetMarketPosition()
Returns an integer series with +1/0/-1 corresponding to the net market position of long/flat/short respectively. This will not work for Ranking strategies or for multiple symbols.
public IntegerSeries GetMarketPosition()
Returns
GetPendingOrders()
Returns an enumerable of pending orders for the primary series or all pending orders if primary series is null.
protected IEnumerable<Order> GetPendingOrders()
Returns
GetPlotInstructions()
Returns a read-only collection of plot instructions that have been issued by the strategy, including a default for the primary series.
public ReadOnlyCollection<PlotInstruction> GetPlotInstructions()
Returns
IsEndOfDay(TimeSpan)
Returns true if the next bar is after the specified time or 24 hours later.
protected bool IsEndOfDay(TimeSpan eod)
Parameters
eod
TimeSpan
Returns
IsEndOfDay(TimeSpan, TimeSpan)
Returns true if the next bar is after the specified time or the timespan between the next bar and the current bar is greater than or equal to the specified gap parameter.
protected bool IsEndOfDay(TimeSpan eod, TimeSpan gap)
Parameters
Returns
Exceptions
IsEndOfWeek()
Returns true if the current date is the last one of the week.
protected bool IsEndOfWeek()
Returns
IsMonthEnd()
Returns true if the current date is the last one of the month.
protected bool IsMonthEnd()
Returns
IsMonthEnd(int)
Returns true if today is n days before month end.
protected bool IsMonthEnd(int days)
Parameters
days
int
Returns
Exceptions
IsQuarterEnd()
Returns true if the current date is quarter end.
protected bool IsQuarterEnd()
Returns
IsQuarterEnd(int)
Returns true if the current date is n days before quarter end.
protected bool IsQuarterEnd(int days)
Parameters
days
int
Returns
IsYearEnd()
Returns true if the current date is the last one of the year.
protected bool IsYearEnd()
Returns
IsYearEnd(int)
Returns true if the current date is the specified number of days before year end.
protected bool IsYearEnd(int days)
Parameters
days
int
Returns
Exceptions
Multiplier(Position, double, string)
Scales up or down the specified position using the specified parameters.
protected void Multiplier(Position position, double multiplier, string signalName)
Parameters
Multiplier(double)
Scales up or down the current position using the specified multiplier.
protected void Multiplier(double multiplier)
Parameters
multiplier
double
Multiplier(double, string)
Scales up or down the current posiiton using the specified multiplier and signal name.
protected void Multiplier(double multiplier, string signalName)
Parameters
MultiplierClose(Position, double, string)
Scales up or down the specified position on the close of the current bar using the specified multiplier and signal name.
protected void MultiplierClose(Position position, double multiplier, string signalName)
Parameters
MultiplierClose(double)
Scales up or down the current position on the close of the current bar using the specified multiplier.
protected void MultiplierClose(double multiplier)
Parameters
multiplier
double
MultiplierClose(double, string)
Scales up or down the current position on the close of the current bar using the specified multiplier and signal name.
protected void MultiplierClose(double multiplier, string signalName)
Parameters
MultiplierLimit(Position, double, double, string)
Scales up or down the specified position using the specified parameters.
protected void MultiplierLimit(Position position, double multiplier, double limitPrice, string signalName)
Parameters
MultiplierLimit(double, double)
Scales up or down the current position using the specified multiplier at the specified limit price.
protected void MultiplierLimit(double multiplier, double limitPrice)
Parameters
MultiplierLimit(double, double, string)
Scales up or down the current position using the specified parameters.
protected void MultiplierLimit(double multiplier, double limitPrice, string signalName)
Parameters
MultiplierStop(Position, double, double, string)
Scales up or down the specified position using the specified parameters.
protected void MultiplierStop(Position position, double multiplier, double stopPrice, string signalName)
Parameters
MultiplierStop(double, double)
Scales up or down the current position at the specified stop.
protected void MultiplierStop(double multiplier, double stopPrice)
Parameters
MultiplierStop(double, double, string)
Scales up or down the current position using the specified parameters.
protected void MultiplierStop(double multiplier, double stopPrice, string signalName)
Parameters
OnBarClose()
Called once for each bar in the primary series. Orders submitted here are for execution on the next bar.
protected virtual void OnBarClose()
OnBarOpen()
Called after the open of the primary series. Pre-existing market orders will already have been executed. Only the open price of the CurrentBar property is available. All other series will still have the prior bar's date. Orders cannot be submitted from this method in production mode.
protected virtual void OnBarOpen()
OnOrderStatusChanged(OrderStatusEventArgs)
Called when the status of an order changes.
protected virtual void OnOrderStatusChanged(OrderStatusEventArgs e)
Parameters
OnOrderSubmitting(Order)
Called before an order is submitted to the execution simulation routine.
protected virtual void OnOrderSubmitting(Order order)
Parameters
order
Order
OnPositionClosed(Position)
Called when a position is closed.
protected virtual void OnPositionClosed(Position position)
Parameters
position
Position
OnPositionClosing(Position)
Called when a position is being closed.
protected virtual void OnPositionClosing(Position position)
Parameters
position
Position
OnPositionOpened(Position)
Called after a position is opened.
protected virtual void OnPositionOpened(Position position)
Parameters
position
Position
OnPositionOpening(Position)
Called when a position is being opened.
protected virtual void OnPositionOpening(Position position)
Parameters
position
Position
OnRoll(Roll, Position)
Called when a roll is processed.
protected virtual void OnRoll(Roll roll, Position position)
Parameters
OnSimulationComplete(TradeStats)
Called after a simulation is complete and TradeStats have been calculated.
protected virtual void OnSimulationComplete(TradeStats results)
Parameters
results
TradeStats
OnStrategyStart()
Called before bars are processed. Useful for indicator setup or other initialization tasks.
protected virtual void OnStrategyStart()
OnStrategyStop()
Called after all all bars have been processed and before any money management has been run.
protected virtual void OnStrategyStop()
Peek()
Returns the next bar in the future for the primary series or null if it is the last bar. For use in backtesting only.
protected Bar Peek()
Returns
Peek(BarSeries)
Returns the next bar in the future for the specified series. For use in backtesting only.
protected Bar Peek(BarSeries series)
Parameters
series
BarSeries
Returns
Peek(BarSeries, int)
Returns the specified number of bars in the future relative to the current bar for the specified series or null if the specified bars peeks beyond the last bar. For use in backtesting only.
protected Bar Peek(BarSeries series, int bars)
Parameters
Returns
Peek(int)
Returns the bar the specified number of bars in the future for the primary series. For use in backtesting only.
protected Bar Peek(int bars)
Parameters
bars
int
Returns
Plot(ISeries, int, Color)
Plots a series with the specified settings.
protected void Plot(ISeries series, int pane, Color color)
Parameters
series
ISeriesThe series to be plotted.
pane
intThe pane to be used. 0 is the default price pane.
color
ColorThe color of the plot.
Plot(ISeries, int, Color, string, int, string, float)
Plots a series with the specified settings.
protected void Plot(ISeries series, int pane, Color color, string chartType = "Line", int width = 1, string lineStyle = "Solid", float paneSize = NaN)
Parameters
series
ISeriesThe series to be plotted.
pane
intThe pane to be used. 0 is the default price pane.
color
ColorThe color.
chartType
stringValid chart types include Stock, Candlestick, Line, Column and Point.
width
intThe width of the plot.
lineStyle
stringThe line style. Valid types include Solid, Dot, Dash, DashDot and DashDotDot.
paneSize
floatThe size of the pane. NaN will autosize, typically to 25% of total chart height.
Plot(PlotInstruction)
Plots a custom PlotInstruction.
protected void Plot(PlotInstruction instruction)
Parameters
instruction
PlotInstruction
Plot(double, int, Color, string, int)
Plots a horizontal line with the specified settings.
protected void Plot(double yValue, int pane, Color color, string lineStyle = "Solid", int width = 1)
Parameters
Rebalance(IEnumerable<Tuple<string, PositionSide>>)
Generates orders to rebalance open positions to look like the specified enumerable of symbol, PositionSide. Experimental.
protected void Rebalance(IEnumerable<Tuple<string, PositionSide>> indications)
Parameters
indications
IEnumerable<Tuple<string, PositionSide>>
Run(Type, VariableDictionary, IEnumerable<BarSeries>)
Runs multiple simulations in parallel returning a merged datastore.
public static DataStoreBase Run(Type strategy, VariableDictionary strategyProperties, IEnumerable<BarSeries> data)
Parameters
strategy
TypestrategyProperties
VariableDictionarydata
IEnumerable<BarSeries>
Returns
Run(Type, VariableDictionary, IEnumerable<BarSeries>, TextWriter, CancellationToken)
Runs multiple simulations in parallel returning a merged datastore.
public static DataStoreBase Run(Type strategy, VariableDictionary strategyProperties, IEnumerable<BarSeries> data, TextWriter output, CancellationToken token)
Parameters
strategy
TypestrategyProperties
VariableDictionarydata
IEnumerable<BarSeries>output
TextWritertoken
CancellationToken
Returns
RunSimulation()
Runs the simulation.
public void RunSimulation()
RunSimulation(BarSeries)
Sets PrimarySeries to the specified BarSeries and runs the simulation.
public void RunSimulation(BarSeries series)
Parameters
series
BarSeriesThe series to test.
RunSimulation(IEnumerable<BarSeries>)
Runs the simulation on the specified collection of BarSeries.
public void RunSimulation(IEnumerable<BarSeries> series)
Parameters
series
IEnumerable<BarSeries>
RunSimulation(IEnumerable<BarSeries>, TextWriter)
Runs the simulation on the specified collection of BarSeries. Prints progress messages to output.
public void RunSimulation(IEnumerable<BarSeries> series, TextWriter output)
Parameters
series
IEnumerable<BarSeries>output
TextWriter
RunSimulation(TextWriter)
Runs the simulation.
public void RunSimulation(TextWriter output)
Parameters
output
TextWriter
Sell()
Submits a sell market order for the current position.
protected void Sell()
Sell(Position)
Submits a sell market order for the specified position.
protected void Sell(Position position)
Parameters
position
Position
Sell(Position, string)
Submits a sell market order for the specified position using the specified signal name.
protected void Sell(Position position, string signalName)
Parameters
Sell(string)
Submits a sell market order for the current position using the specified signal name.
protected void Sell(string signalName)
Parameters
signalName
string
SellClose()
Submits a sell order MOC on the current bar for the current position.
protected void SellClose()
SellClose(Position)
Submits a sell order MOC on the current bar for the specified position.
protected void SellClose(Position position)
Parameters
position
Position
SellClose(Position, string)
Submits a sell order MOC on the current bar for the specified position using the specified signal name.
protected void SellClose(Position position, string signalName)
Parameters
SellClose(string)
Submits a sell order MOC on the current bar for the current position using the specified signal name.
protected void SellClose(string signalName)
Parameters
signalName
string
SellLimit(Position, double)
Submits a sell limit order for the specified position using the specified limit price.
protected void SellLimit(Position position, double limitPrice)
Parameters
SellLimit(Position, double, string)
Submits a sell limit order using the specified parameters.
protected void SellLimit(Position position, double limitPrice, string signalName)
Parameters
SellLimit(double)
Submits a limit order for the current position using the specified limit price.
protected void SellLimit(double limitPrice)
Parameters
limitPrice
double
SellLimit(double, string)
Submits a limit order for the current position using the specified limit price and signal name.
protected void SellLimit(double limitPrice, string signalName)
Parameters
SellShort()
Submits a sell short market order for the primary series.
protected void SellShort()
SellShort(BarSeries)
Submits a sell short market order for the specified series.
protected void SellShort(BarSeries series)
Parameters
series
BarSeries
SellShort(BarSeries, string)
Submits a sell short market order for the specified series using the specified signal name.
protected void SellShort(BarSeries series, string signalName)
Parameters
SellShort(string)
Submits a sell short market order for the primary series using the specified signal name.
protected void SellShort(string signalName)
Parameters
signalName
string
SellShortClose()
Submits a MOC sell short order on the current bar for the primary series.
protected void SellShortClose()
SellShortClose(BarSeries)
Submits a MOC sell short order on the current bar for the specified series.
protected void SellShortClose(BarSeries series)
Parameters
series
BarSeries
SellShortClose(BarSeries, string)
Submits a MOC sell short order on the current bar for the specified series using the specified signal name.
protected void SellShortClose(BarSeries series, string signalName)
Parameters
SellShortClose(string)
Submits a MOC sell short order on the current bar for the primary series using the specified signal name.
protected void SellShortClose(string signalName)
Parameters
signalName
string
SellShortLimit(BarSeries, double)
Submits a sell short limit order for the specified series using the specified limit price.
protected void SellShortLimit(BarSeries series, double limitPrice)
Parameters
SellShortLimit(BarSeries, double, string)
Submits a sell short limit order using the specified parameters.
protected void SellShortLimit(BarSeries series, double limitPrice, string signalName)
Parameters
SellShortLimit(double)
Submits a sell short limit order for the primary series using the specified limit price.
protected void SellShortLimit(double limitPrice)
Parameters
limitPrice
double
SellShortLimit(double, string)
Submits a sell short limit order for the primary series using the specified limit price and signal name.
protected void SellShortLimit(double limitPrice, string signalName)
Parameters
SellShortPair(BarSeries, BarSeries)
Sells short the primary series buying the secondary series against it.
protected void SellShortPair(BarSeries primary, BarSeries secondary)
Parameters
SellShortPair(BarSeries, BarSeries, string)
Sells short the primary series buying the secondary against it using the specified signal name.
protected void SellShortPair(BarSeries primary, BarSeries secondary, string signalName)
Parameters
SellShortPairClose(BarSeries, BarSeries)
Sells short the primary series buying the secondary series against it MOC.
protected void SellShortPairClose(BarSeries primary, BarSeries secondary)
Parameters
SellShortPairClose(BarSeries, BarSeries, string)
Sells short the primary series buying the secondary series against it MOC using the specified signal name.
protected void SellShortPairClose(BarSeries primary, BarSeries secondary, string signalName)
Parameters
SellShortStop(BarSeries, double)
Submits a sell short stop order for the specified series using the specified stop price.
protected void SellShortStop(BarSeries series, double stopPrice)
Parameters
SellShortStop(BarSeries, double, string)
Submits a sell short stop order using the specified parameters.
protected void SellShortStop(BarSeries series, double stopPrice, string signalName)
Parameters
SellShortStop(double)
Submits a sell short stop order for the primary series using the specified stop price.
protected void SellShortStop(double stopPrice)
Parameters
stopPrice
double
SellShortStop(double, string)
Submits a sell short stop order for the primary series using the specified stop price and signal name.
protected void SellShortStop(double stopPrice, string signalName)
Parameters
SellStop(Position, double)
Submits a sell stop order for the specified position using the specified stop price.
protected void SellStop(Position position, double stopPrice)
Parameters
SellStop(Position, double, string)
Submits a sell stop order using the specified parameters.
protected void SellStop(Position position, double stopPrice, string signalName)
Parameters
SellStop(double)
Submits a sell stop order for the current position using the specified stop price.
protected void SellStop(double stopPrice)
Parameters
stopPrice
double
SellStop(double, string)
Submits a sell stop order for the current position using the specified stop price and signal name.
protected void SellStop(double stopPrice, string signalName)
Parameters
SetUserRisk(Position, double)
Used to inform the money manager of risk even when not using stops which calculate risk automatically.
protected void SetUserRisk(Position position, double risk)
Parameters
SnapEvent(object)
Captures the current index for event analysis.
protected void SnapEvent(object eventValue = null)
Parameters
eventValue
object
Stop()
Stops a running simulation at the earliest opportunity. Code will resume at OnStrategyStop.
protected void Stop()
SubmitOrder(Order)
Submits the specified order.
protected void SubmitOrder(Order order)
Parameters
order
Order
Events
OrderStatusChanged
Raised when the status of an order changes.
public event EventHandler<OrderStatusEventArgs> OrderStatusChanged