private void CalculateDealCloseTimeOnly(DealInfo i) { if (m_nowPrice.low == 0 || m_nowPrice.high == 0) { throw new AssertException("nowPrice low or high is not set."); } if (i.DealType == 'B') { if (m_nowPrice.low <= i.ClosePriceSl + spread) { float cost = (i.ClosePriceSl - i.OpenPrice - spread) * GetPointInv(m_nowPrice.close); i.CloseTime = m_nowTime; i.Cost = -cost; } else if (m_nowPrice.high >= i.ClosePriceTp - spread) { float cost = (i.ClosePriceTp - i.OpenPrice - spread) * GetPointInv(m_nowPrice.close); i.CloseTime = m_nowTime; i.Cost = -cost; } else { } } else { if (m_nowPrice.high + spread > i.ClosePriceSl) { float cost = ((i.OpenPrice - i.ClosePriceSl) - spread) * GetPointInv(m_nowPrice.close); i.CloseTime = m_nowTime; i.Cost = -cost; } else if (m_nowPrice.low + spread < i.ClosePriceTp) { float cost = ((i.OpenPrice - i.ClosePriceTp) - spread) * GetPointInv(m_nowPrice.close); i.CloseTime = m_nowTime; i.Cost = -cost; } else { } } }
public void AddDeal(DealInfo dealInfo) { m_deals.Add(dealInfo); }