aliuzun:
hello everybody. I try to learn mql programming with your site. İt is very useful .
I made ea but need your help.
<CODE REMOVED>
Please read some other posts before posting . . .
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
- Use SRC
- Check your return codes and Print errors so you find out why
- if((iMACD(NULL,0,24,400,20,PRICE_CLOSE,MODE_MAIN,2)<=0)&&(iMACD(NULL,0,24,400,20,PRICE_CLOSE,MODE_MAIN,1)>0) ||(iMACD(NULL,0,24,400,20,PRICE_CLOSE,MODE_MAIN,0)>0)&&(iMACD(NULL,0,12,26,13,PRICE_CLOSE,MODE_MAIN,2)<=0)&&(iMACD(NULL,0,12,26,13,PRICE_CLOSE,MODE_MAIN,1)>0)) // Here is your open buy ruleDon't write unreadable, non-understandable likely typo-error filled code.
double MACD1(int iBar){ return( iMACD(NULL,0,24,400,20,PRICE_CLOSE,MODE_MAIN,iBar) ); } double MACD2(int iBar){ return( iMACD(NULL,0,12,26,13,PRICE_CLOSE,MODE_MAIN,iBar) ); } : double macd12 = MACD1(2), macd22 = MACD2(2), macd11 = MACD1(1), macd21 = MACD2(1), macd10 = MACD1(0); bool isBuy1 = macd12 <= 0 && macd11 > 0, isBuy2 = macd10 > 0 && macd22 <= 0 && macd21 > 0; if(isBuy1 || isBuy) // Here is your open buy rule
Now you can print the values and the test variables and find out WHY it doesn't open. - When closing, you MUST count down. Get in the habit of always counting down.
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 everybody. I try to learn mql programming with your site. İt is very useful .
I made ea but need your help.
with macd 24.400.20 and macd 12.26.13. ( only buy no sell at macd 24.400.20 >0 )
Buy rule:a) macd 24.400.20 shift2 <=0 ,macd 24.400.20 shift1 >0
b) macd 24.400.20 shift 0 >0 , macd 12.26.13. shift 1<=0 , macd 12.26.13. shift 0 >0
it closes at reverse condition.
it is logically good ea but there is a fault. It doesnt open position on condition b. ı read mql book but ı couldnt find the solution. is there a return problem how can solve this mistake. could you help me
I tried to rearrange my message.