New MACD - Accuracy?

 

I have a MACD version that is supposedly more accurate. It uses EMA for the signal calculation as well. I tried making the same MACD by modifying the MACD in MT4 but it is not coming up with the same numbers.

Can we port this over to MT4? I've been working on this for a long time, and I've labeled a few pieces but I don't know why they are doing some things.

Here is the *gasp gasp finally* source code to the version of MACD that I'd like to port over, written in Java:

public static void a(float[] fs, int i, int i_47_, float f, float f_48_,

float f_49_, float[] fs_50_, float[] fs_51_,

float[] fs_52_) { //f[],i,i,f,f,f,f[],f[],f[]

//history, counter1?, counter2?, param1, param2, paramSignal, line1, line2, lineSignal

float f_53_ = 2.0F / (f + 1.0F);

float f_54_ = 2.0F / (f_48_ + 1.0F);

float f_55_ = 2.0F / (f_49_ + 1.0F); //Is this how an EMA is made exponential?

for (int i_56_ = 0; i_56_ <= i && i_56_ < i_47_; i_56_++) //counter less than i_47_

{ //i_56_ is a bar counter? //i is number of bars to count

fs_50_ = 0.0F; //is this zeroing out values? YES. Overwritten at end...

fs_51_ = 0.0F;

fs_52_ = 0.0F;

}

if (i < i_47_)

{

a(fs, i, i_47_, f_54_, (int) f_48_, fs_51_); //Is that an MA? f[],i,i,f,i,f[]

a(fs, i, i_47_, f_53_, (int) f, fs_52_); //Is that an MA? f[],i,i,f,i,f[]

for (int i_57_ = 0; i_57_ < i; i_57_++)

fs_50_ = 0.0F; //Zero line on range

for (int i_58_ = i; i_58_ < i_47_; i_58_++)

fs_50_ = fs_51_ - fs_52_; //Calculates Signal line

a(fs_50_, i + (int) f - 1, i_47_, f_55_, (int) f_49_, fs_51_); //f[],i,i,f,i,f[] //EMA on signal

for ( int i_59_ = 0;

i_59_ < i+ (int)f_48_ - 1;

i_59_++

)

fs_52_ = 0.0F;

for ( int i_60_ = i+ (int)f_48_ - 1;

i_60_ < i_47_;

i_60_++

)

fs_52_ = fs_50_ - fs_51_;

int i_61_ = i + (int) f + (int) f_49_ - 1;

for (int i_62_ = 0; i_62_ < i_61_; i_62_++) //WTF?

{

fs_50_ = fs_50_;

fs_51_ = fs_51_;

fs_52_ = fs_52_;

}

}

}

public static float[] a(float[] fs, int i, int i_91_, float f, int i_92_,

float[] fs_93_) { //THIS IS EMA //f[],i,i,f,i,f[]

//a(fs, i, i_47_, f_54_, (int) f_48_, fs_51_);

//a(fs, i, i_47_, f_53_, (int) f, fs_52_);

//a(fs_50_, i + (int) f - 1, i_47_, f_55_, (int) f_49_, fs_51_);

if (fs_93_ == null || fs_93_.length < i_91_)

fs_93_ = new float;

if (i >= i_91_)

return fs_93_;

float f_94_ = 0.0F;

for (int i_95_ = i; i_95_ < i + i_92_ && i_95_ < i_91_; i_95_++)

f_94_ += fs;

fs_93_ = f_94_ / (float) i_92_;

for (int i_96_ = i + i_92_; i_96_ < i_91_; i_96_++)

fs_93_ = (1.0F - f) * fs_93_ + f * fs;

int i_97_ = i + i_92_ - 1;

for (int i_98_ = 0; i_98_ < i_97_ && i_98_ < i_91_; i_98_++)

fs_93_ = fs_93_;

return fs_93_;

}
 

This is probably pretty easy, but my brain is just fried at this point... I think the EMA is the same as the EMA used in MT4 but I'm not 100% certain since the prices are different.

 

Way to go Daraknor!!!

You never quit.

I'd love to check out any indicator you come up with.

If you don't get the response you want please give me the okay to spread your request to Forex Factory and other places (Neoticker forum) where there might be programmers grateful for your MACD who'll Mt4-it.

Reason: