MA cross/Price cross MA EA - page 16

 
mladen:
Here is an Ea that is as simple as it gets (I can not think of a simpler way to do that) that opens orders when price crosses moving average and closes opposite order (of exists) before opening a new order. It allows only one opened order per symbol-magic number combination. There are not extra controls nor anything complicated in the EA. The only "complicated" thing is the ECN broker choice (in order to be able to handle stop loss and take profit on ECN type brokers). If you remove comment lines, it is abou 60 lines of code all in all All the best

Hi mladen,

your 'price cross ma simple.mq4' ea is about the only version from this thread that is not getting trashed by the latest MT4 downgrade (they call it UPdate, haha). When compiling the other ea's, there's 35 errors in the code now:

'Price Cross Ma Ea_v1.05.mq4' Price Cross Ma Ea_v1.05.mq4 1 1

'stdlib.mqh' stdlib.mqh 1 1

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 51 17

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 52 17

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 53 17

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 54 17

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 55 17

return value of 'OrderSelect' should be checked Price Cross Ma Ea_v1.05.mq4 159 10

return value of 'OrderClose' should be checked Price Cross Ma Ea_v1.05.mq4 163 40

return value of 'OrderClose' should be checked Price Cross Ma Ea_v1.05.mq4 164 40

return value of 'OrderSelect' should be checked Price Cross Ma Ea_v1.05.mq4 179 7

check operator precedence for possible error; use parentheses to clarify precedence Price Cross Ma Ea_v1.05.mq4 241 131

return value of 'OrderSelect' should be checked Price Cross Ma Ea_v1.05.mq4 261 7

return value of 'OrderModify' should be checked Price Cross Ma Ea_v1.05.mq4 277 11

return value of 'OrderModify' should be checked Price Cross Ma Ea_v1.05.mq4 294 12

'void' function returns a value Price Cross Ma Ea_v1.05.mq4 313 83

'void' function returns a value Price Cross Ma Ea_v1.05.mq4 336 83

'void' function returns a value Price Cross Ma Ea_v1.05.mq4 393 110

return value of 'OrderSend' should be checked Price Cross Ma Ea_v1.05.mq4 402 10

'void' function returns a value Price Cross Ma Ea_v1.05.mq4 437 110

return value of 'OrderSend' should be checked Price Cross Ma Ea_v1.05.mq4 446 10

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 476 13

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 476 40

')' - semicolon expected Price Cross Ma Ea_v1.05.mq4 476 56

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 477 13

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 477 40

'+' - semicolon expected Price Cross Ma Ea_v1.05.mq4 477 56

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 13

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 37

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 50

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 62

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 73

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 83

')' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 97

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 13

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 37

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 50

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 62

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 73

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 83

'+' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 97

'cl' - undeclared identifier Price Cross Ma Ea_v1.05.mq4 501 13

'clnow' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 501 16

'manow' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 501 27

'clpre' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 501 39

'mapre' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 501 50

'cl' - undeclared identifier Price Cross Ma Ea_v1.05.mq4 527 13

'clnow' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 527 16

'manow' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 527 27

'clpre' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 527 39

'mapre' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 527 50

35 error(s), 14 warning(s) 36 15

If there's a simple way to fix this, that would be nice, 'cause I was planning on fiddling around with these ea's a little more...

Hope you're doing fine.

Kind regards,

Ronald

 
ronald123:
Hi mladen,

your 'price cross ma simple.mq4' ea is about the only version from this thread that is not getting trashed by the latest MT4 downgrade (they call it UPdate, haha). When compiling the other ea's, there's 35 errors in the code now:

'Price Cross Ma Ea_v1.05.mq4' Price Cross Ma Ea_v1.05.mq4 1 1

'stdlib.mqh' stdlib.mqh 1 1

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 51 17

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 52 17

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 53 17

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 54 17

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 55 17

return value of 'OrderSelect' should be checked Price Cross Ma Ea_v1.05.mq4 159 10

return value of 'OrderClose' should be checked Price Cross Ma Ea_v1.05.mq4 163 40

return value of 'OrderClose' should be checked Price Cross Ma Ea_v1.05.mq4 164 40

return value of 'OrderSelect' should be checked Price Cross Ma Ea_v1.05.mq4 179 7

check operator precedence for possible error; use parentheses to clarify precedence Price Cross Ma Ea_v1.05.mq4 241 131

return value of 'OrderSelect' should be checked Price Cross Ma Ea_v1.05.mq4 261 7

return value of 'OrderModify' should be checked Price Cross Ma Ea_v1.05.mq4 277 11

return value of 'OrderModify' should be checked Price Cross Ma Ea_v1.05.mq4 294 12

'void' function returns a value Price Cross Ma Ea_v1.05.mq4 313 83

'void' function returns a value Price Cross Ma Ea_v1.05.mq4 336 83

'void' function returns a value Price Cross Ma Ea_v1.05.mq4 393 110

return value of 'OrderSend' should be checked Price Cross Ma Ea_v1.05.mq4 402 10

'void' function returns a value Price Cross Ma Ea_v1.05.mq4 437 110

return value of 'OrderSend' should be checked Price Cross Ma Ea_v1.05.mq4 446 10

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 476 13

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 476 40

')' - semicolon expected Price Cross Ma Ea_v1.05.mq4 476 56

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 477 13

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 477 40

'+' - semicolon expected Price Cross Ma Ea_v1.05.mq4 477 56

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 13

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 37

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 50

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 62

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 73

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 83

')' - semicolon expected Price Cross Ma Ea_v1.05.mq4 478 97

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 13

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 37

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 50

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 62

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 73

'.' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 83

'+' - semicolon expected Price Cross Ma Ea_v1.05.mq4 479 97

'cl' - undeclared identifier Price Cross Ma Ea_v1.05.mq4 501 13

'clnow' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 501 16

'manow' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 501 27

'clpre' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 501 39

'mapre' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 501 50

'cl' - undeclared identifier Price Cross Ma Ea_v1.05.mq4 527 13

'clnow' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 527 16

'manow' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 527 27

'clpre' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 527 39

'mapre' - struct or class type expected Price Cross Ma Ea_v1.05.mq4 527 50

35 error(s), 14 warning(s) 36 15

If there's a simple way to fix this, that would be nice, 'cause I was planning on fiddling around with these ea's a little more...

Hope you're doing fine.

Kind regards,

Ronald

Ronal

Here is a cleaned up version : price_cross_ma_ea_v1.05_nmc.mq4

PS: it will not work with build 509 or earlier

 

Updated Price cross ma Ea to work on new mt4 builds, also updated the time filter and the min max distance, the time filter is working far as I can tell but still not 100% sure about the min max distance, needs testing to be sure.

 

Version 1.03 made new mql compatible too : price_cross_ma_ea_v1.03_nmc.mq4

 

HI Mladen,

Hope you are well. I need your generous assistance in tweaking this EA we worked upon few months ago. Could you please see that:

1 it doesn't open trade out of trading hours

2 The max and min distance para work

I will be grateful Thanks Sachin

 
mrtools:
Updated Price cross ma Ea to work on new mt4 builds, also updated the time filter and the min max distance, the time filter is working far as I can tell but still not 100% sure about the min max distance, needs testing to be sure.

Mrtools build 765 does not show it in the experts listing. Something wrong?

 
sachin_syd:
Mrtools build 765 does not show it in the experts listing. Something wrong?

Sachin_syd, shows on build 765 for me.

Files:
pcma_1.07.png  53 kb
 
mrtools:
Sachin_syd, shows on build 765 for me.

Thanks I guess there was issue with my Terminal.

Now that you have fixed this one can you also fix the Ma price cross HiLo EA on post 153 above. I have been using it for over a year with decent results but the max distance eats lots of pips or makes entry expensive. YOu may instead modify this Single MA ver 7 nmc into dual MA if more convenient. THANKS

 
sachin_syd:
HI Mladen,

Hope you are well. I need your generous assistance in tweaking this EA we worked upon few months ago. Could you please see that:

1 it doesn't open trade out of trading hours

2 The max and min distance para work

I will be grateful Thanks Sachin

Here is a version compatible with new mt4 : price_cross_ma_hi-lo_ea_v1.01_nmc.mq4

 

Mladen, I tried putting this on ver 4 build 765 , 3 different broker MT4 platform but doesnt show in EA list???

Reason: