And I find out, if I change the code from
... MacdCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0); MacdPrevious=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1); SignalCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0); SignalPrevious=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1); ... to ... MacdCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1); MacdPrevious=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,2); SignalCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1); SignalPrevious=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,2); ...
then it works.
But in this case, the signal has delay as shown below:
Any way to overcome this?
thomas2004: Any way to overcome this?
| Overcome what?
|
whroeder1:
Overcome what?
|
1. Premature? You mean the so-called forward bias?
2. I've seen quite a lot of EAs which use the current bar and the second bar, i.e [0] and [1] and seems quite OK. But in my EA when I use these, I got wrong signals.
From the second screenshot one can see the signal delay is to much. Do you think it is normal?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I am new by EA. I try to build a very simple EA such as using the MACD to check if there is a golden cross (MACD crosses over the signal). If there is golden cross, go long. If there is a dead cross, close the long position. My EA is attached. By back testting one can see the long position is close though there is no dead cross.