abx89: unfortunately it closes position in way which I cant understand.
|
|
Thank you for answer. I didnt notice that I check close and low so i have changed it but there is still the same problem.
exit() code:
int exit() { int Direcao = 0; double MACD0 =0 , MACDsignal0 =0; double adx0,adx1,adx2, pDI, mDI; MACD0 = iMACD(NULL, 0, 12, 26, 9,PRICE_CLOSE, MODE_MAIN,1); MACDsignal0 = iMACD(NULL, 0, 12, 26, 9,PRICE_CLOSE, MODE_SIGNAL,1); adx0 = iADX(NULL, 0, 14, PRICE_CLOSE,MODE_MAIN, 0); adx1 = iADX(NULL, 0, 14, PRICE_CLOSE,MODE_MAIN, 1); adx2 = iADX(NULL, 0, 14, PRICE_CLOSE,MODE_MAIN, 2); pDI = iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,0); mDI = iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,0); if(pDI <= adx0 ) { Print("+DI[0] = ", pDI, "ADX[0] = ", adx0); Direcao = 3; //buy } if(mDI <= adx0 ) { Print("-DI[0] = ", mDI, "ADX[0] = ", adx0); Direcao = 4; } return (Direcao); }

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
Hello,
I have problem with my EA which Im trying to create.
Look like that this ea's open position well but unfortunately it closes position in way which I cant understand.
I would like to close long position when +DI is below the ADX and I want to close short when -DI is smaller than ADX.
Below is my code for that EA. Can anybody tell me whats wrong with it and how can i improve it to work fine?
I also put screenshot from tester where this situation is visable.
Best Regards