void ElementStyleCache::Clear() { ClearBorder(); ClearMargin(); ClearPadding(); ClearDimensions(); ClearOverflow(); ClearPosition(); ClearFloat(); ClearDisplay(); ClearWhitespace(); }
void CStrategyGrid::Tick(CTickData * pt) { m_lastPrice = pt->lastprice; m_hignPrice = pt->highestprice; m_pricebid1 = pt->bidprice[0]; m_priceask1 = pt->askprice[0]; m_fyingkuiPosition = 0; for(int i=0;i<m_arPosition.GetSize();i++) { TPosition * pos= (TPosition *)m_arPosition[i]; double temp = 0 ; if( pos->direction == '0' ) { temp = ( pt->lastprice - pos->price ) * pos->count * m_nInstrumentValue; } else if( pos->direction == '1' ) { temp = ( pos->price - pt->lastprice) * pos->count * m_nInstrumentValue; } m_fyingkuiPosition += temp; } //风险和资金管理控制 if( ( m_fyingkuiPosition + m_fyingkuiClose ) < m_nMaxLost && m_nMaxLost < -1 ) //0 的时候不启用 { m_bRun = 0; char msg[128]; sprintf_s(msg,128,"最大亏损%.3f 超过最大初始风险设置,清仓,停止策略允许",m_fyingkuiPosition + m_fyingkuiClose); AddLog(msg); ClearPosition(); } if( ( m_fyingkuiPosition + m_fyingkuiClose ) > m_maxProfit ) { m_maxProfit = ( m_fyingkuiPosition + m_fyingkuiClose ); } float back = m_maxProfit - ( m_fyingkuiPosition + m_fyingkuiClose ); if( back > m_fProfitBackStop && m_fProfitBackStop > 1 ) //0 的时候不启用 { m_bRun = 0; char msg[128]; sprintf_s(msg,128,"资金回撤%.3f 超过资金回撤门限,清仓,停止策略允许",back); AddLog(msg); ClearPosition(); } }