RSI Identificator
RSI Identificator
Welche Methode wird für RSI Berechnung benutzt? SMA? Verstehe nicht wocher der Unterschied kommt....
- Attachments
-
- RSI_Properties.jpg (250.14 KiB) Viewed 8248 times
-
- RSI.jpg (212.8 KiB) Viewed 8248 times
Re: RSI Identificator
Hier der Code
Code: Select all
void CRelativeStrengthIndex::OnBarUpdate()
{
float fRSI, fSumUp, fSumDown;
DWORD dwBarIdx = m_pModule->BarIndex();
if (m_pModule->BarIndex() > m_wPeriods) {
fSumUp = fSumDown = 0.0f;
for (WORD i = 0; i < m_wPeriods; ++i) {
fSumUp += max(0.0f, Close(i) - Close(i+1));
fSumDown += -(min(0.0f, Close(i) - Close(i+1)));
}
fSumUp = fSumUp / m_wPeriods;
fSumDown = fSumDown / m_wPeriods;
if(fSumUp + fSumDown == 0) {
fRSI = 0;
}
else {
fRSI = (fSumUp / (fSumUp + fSumDown) * 100);
}
m_Series[dwBarIdx] = fRSI;
}
}