Anybody how to create MACD(Moving Average Convergence Divergence)?
can i create MACD by using spesial class,or i must calculate manually, and then use line chart to draw it?
Thanks before.
regards,
Ratna
How to create MACD(Moving Average Convergence Divergence)?
Here is the routine I use to calculate it:
public String [] histo2( String[] st,int n)
{
double fm26,fm12;
int k;
String [] tab =new String[2];
String [] tm= new String[n+1];
String [] ts= new String[n+1];
for( k=n-50; k <n+1; k++) {
fm26 =Float.parseFloat(calMoymeu(st,26,k));
fm12=Float.parseFloat(calMoymeu(st,12,k));
tm[k]=String.valueOf(fm12-fm26);
}
for( k=n-40; k <n+1; k++) {
ts[k]=calMoymeu(tm,9,k);
}
int iflagk,i,j;
tab[0]=tm[n];
tab[1]=ts[n];
return tab;
}
// tm and ts are respectively the fast and slow Moving Average
n is the time index (can be day,month or whatever)
st is the corresponding stock value
You have also to create Exponential Moving function(CalMoymeu) //
public String [] histo2( String[] st,int n)
{
double fm26,fm12;
int k;
String [] tab =new String[2];
String [] tm= new String[n+1];
String [] ts= new String[n+1];
for( k=n-50; k <n+1; k++) {
fm26 =Float.parseFloat(calMoymeu(st,26,k));
fm12=Float.parseFloat(calMoymeu(st,12,k));
tm[k]=String.valueOf(fm12-fm26);
}
for( k=n-40; k <n+1; k++) {
ts[k]=calMoymeu(tm,9,k);
}
int iflagk,i,j;
tab[0]=tm[n];
tab[1]=ts[n];
return tab;
}
// tm and ts are respectively the fast and slow Moving Average
n is the time index (can be day,month or whatever)
st is the corresponding stock value
You have also to create Exponential Moving function(CalMoymeu) //
Forget to tell, calculation algorithm of MACD and other technical indicators like Stochastic oscillator, ADX, Chaikin Money Flow, Bollinger Bands at following URL:
http://stockcharts.com/education/Indica ... index.html
I had also compare it with several famous URL. It is correct & tested by QE/QA team.... The algorithm for technical indicators above in this website is accurate...
If u have any doubts, maybe I can help (if I am capable to do so).
regards,
wei wei.
http://stockcharts.com/education/Indica ... index.html
I had also compare it with several famous URL. It is correct & tested by QE/QA team.... The algorithm for technical indicators above in this website is accurate...
If u have any doubts, maybe I can help (if I am capable to do so).
regards,
wei wei.
check http://www.activestocks.de/ccapi for indicator implementations in java.
Thanks,
If you find errors, please report them.
Thanks,
Ulrich
Thanks,
If you find errors, please report them.
Thanks,
Ulrich