public static void Close(this SystemState systemState, int positionIndex, DateTime ts, float price, ISlippage slippage, ICommission commission) { float closePrice = systemState.CalculateSlippageClose(slippage, ts, positionIndex, price); systemState.Close(positionIndex, ts, closePrice, systemState.CalculateCommission(commission, positionIndex, closePrice)); }
public static float CalculateSlippageClose(this SystemState systemState, ISlippage slippage, DateTime ts, int positionIndex, float price) { return(systemState.CalculateSlippageClose(slippage, systemState.PositionsActive[positionIndex].Stock.Type, ts, systemState.PositionsActive[positionIndex].Direction, price)); }