Class LimitFillModel
- Namespace
- Balsam
- Assembly
- Balsam.Backtester.dll
Abstract base class for limit fill models that control how limit orders are filled.
public abstract class LimitFillModel : ICloneable
- Inheritance
-
LimitFillModel
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
AllowFillOutsideOfRange
Gets/sets whether orders can be filled on the closing price when it is outside of the day's range.
public bool AllowFillOutsideOfRange { get; set; }
Property Value
FillAtLimitPrice
Gets/sets whether limit orders are filled at the limit price even if the market gaps through the limit.
public bool FillAtLimitPrice { get; set; }
Property Value
FillAtLimitTimeout
Gets/sets the amount of time an order must be active before it can be filled on a gap open instead of at the limit price. This allows for fills on bonafide gaps even when FillAtLimitPrice is true. Defaults to one day.
public TimeSpan FillAtLimitTimeout { get; set; }
Property Value
PriceCross
Price must cross limit to receive a fill.
public static LimitFillModel PriceCross { get; }
Property Value
PriceTouch
Price must touch limit to receive a fill.
public static LimitFillModel PriceTouch { get; }
Property Value
Methods
Clone()
Returns a copy of this limit fill model.
public LimitFillModel Clone()
Returns
GetFill(Order, Bar, SimulationTime)
Called when a limit order is processed.
public double? GetFill(Order order, Bar bar, SimulationTime simulationTime)
Parameters
order
Orderbar
BarsimulationTime
SimulationTime
Returns
OnClone()
Returns a shallow copy using MemberwiseClone().
protected LimitFillModel OnClone()
Returns
OnGetFill(Order, Bar, SimulationTime)
Contains the core limit order fill simulation logic. Override this method to completely change order handling logic.
protected virtual double? OnGetFill(Order order, Bar bar, SimulationTime simulationTime)
Parameters
order
Orderbar
BarsimulationTime
SimulationTime
Returns
OnPriceEqualsLimit(Order, Bar, SimulationTime)
This method is called when attempting to buy the low or sell the high of a bar. Override to determine whether the order fills or not.
protected abstract bool OnPriceEqualsLimit(Order order, Bar bar, SimulationTime simulationTime)
Parameters
order
Orderbar
BarsimulationTime
SimulationTime