예제 #1
0
파일: DealsInfo.cs 프로젝트: vseledkin/MLEA
 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
         {
         }
     }
 }
예제 #2
0
파일: DealsInfo.cs 프로젝트: wushian/MLEA
 public void AddDeal(DealInfo dealInfo)
 {
     m_deals.Add(dealInfo);
 }
예제 #3
0
파일: DealsInfo.cs 프로젝트: vseledkin/MLEA
 public void AddDeal(DealInfo dealInfo)
 {
     m_deals.Add(dealInfo);
 }
예제 #4
0
파일: DealsInfo.cs 프로젝트: wushian/MLEA
 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
         {
         }
     }
 }