Exemplo n.º 1
0
int CMOBV::GetSignal( int nIndex, UINT * pnCode )
{
	if( pnCode )	*pnCode	=	ITSC_NOTHING;
	if( !m_pKData || nIndex < 0 || nIndex >= m_pKData->GetSize() )
		return ITS_NOTHING;

	PrepareCache( 0, -1, FALSE );
	
	int	nMaxDays	=	max( m_nDays1 , m_nDays2 );
	double	dLiminalLow = 0, dLiminalHigh = 0;
	if( !IntensityPreparePrice( nIndex, pnCode, nMaxDays, ITS_GETMINMAXDAYRANGE, &dLiminalLow, &dLiminalHigh, 0.5, 0.5 ) )
		return ITS_NOTHING;

	double	dPriceNow	=	m_pKData->MaindataAt(nIndex);

	if( dPriceNow < dLiminalLow
		&& ( IsGoldenFork( nIndex, m_pdCache1, m_pdCache2 ) || IsGoldenFork( nIndex, m_pdCache2, m_pdCache3 ) ) )
	{	// 低位金叉
		if( pnCode )	*pnCode	=	ITSC_GOLDENFORK;
		return m_itsGoldenFork;
	}
	if( dPriceNow > dLiminalHigh
		&& ( IsDeadFork( nIndex, m_pdCache1, m_pdCache2 ) || IsDeadFork( nIndex, m_pdCache2, m_pdCache3 ) ) )
	{	// 高位死叉
		if( pnCode )	*pnCode	=	ITSC_DEADFORK;
		return m_itsDeadFork;
	}

	return	ITS_NOTHING;
}
Exemplo n.º 2
0
// 得到金叉或者死叉信号
int CTechnique::GetForkSignal(int nIndex, double * pdValue1, double * pdValue2,
							  UINT itsGoldenFork, UINT itsDeadFork, UINT *pnCode )
{
	if( pnCode )	*pnCode	=	ITSC_NOTHING;

	if( IsGoldenFork( nIndex, pdValue1, pdValue2 ) )
	{
		if( pnCode )	*pnCode	=	ITSC_GOLDENFORK;
		return itsGoldenFork;
	}
	if( IsDeadFork( nIndex, pdValue1, pdValue2 ) )
	{
		if( pnCode )	*pnCode	=	ITSC_DEADFORK;
		return itsDeadFork;
	}
	return ITS_NOTHING;
}