Mq4 need a code that makes my EA only work on EURUSD M30

To add comments, please log in or register
Zainab El Issaoui
611
Zainab El Issaoui  
Help me please finish my EA
Mq4 need a code that makes my EA only work on EURUSD M30
Only work in this currency pair and if they try to work in another Time Frame or another currency pair does not work and the alert is reflected in the Journal of MT4

Thank you
Alain Verleyen
36171
Alain Verleyen  
Zainab El Issaoui:
Help me please finish my EA
Mq4 need a code that makes my EA only work on EURUSD M30
Only work in this currency pair and if they try to work in another Time Frame or another currency pair does not work and the alert is reflected in the Journal of MT4

Thank you
It's 10 USD job, you can ask on the freelance section.
Snelle Moda
661
Snelle Moda  

Hi put this in the beginning of your code.


// Check if current symbol is different then EURUSD.
// Check if current chart period is different then M30 
   if(Symbol() != "EURUSD" || Period() != PERIOD_M30)
         {         
         Alert("Wrong symbol or chart period.");            
         return;                
         }
Zainab El Issaoui
611
Zainab El Issaoui  
Snelle Moda:

Hi put this in the beginning of your code.


Thanks but no work ... The alert appears but the robot makes operations ...
I just want to open operations in EURUSD M30

  Thank you
Siti Latifah
13877
Siti Latifah  
Zainab El Issaoui:
Thanks but no work ... The alert appears but the robot makes operations ...
I just want to open operations in EURUSD M30

  Thank you

put the code in the beginning of start() function.

if(Symbol() != "EURUSD" || Period() != PERIOD_M30)
         {         
         Alert("Wrong symbol or chart period.");            
         return(0);                
         }
Zainab El Issaoui
611
Zainab El Issaoui  
Siti Latifah:

put the code in the beginning of start() function.

Thanks to the 2 support ... and works well ...
A hug from Spain
Osama Shaban
1549
Osama Shaban  

As you need it to be printed in the journal, Print( ) is used instead of Alert( ) ...

if(Symbol() != "EURUSD" || Period() != PERIOD_M30)
         {         
         Print("Wrong symbol or chart period.");            
         return(0);                
         }
Steve
69
Steve  

Is there away to include multiple instruments i.e. different brokers have different prefix / suffix "EURUSD" "EURUSDSB" etc?

Thanks

Fernando Carreiro
4461
Fernando Carreiro  
Steve: Is there away to include multiple instruments i.e. different brokers have different prefix / suffix "EURUSD" "EURUSDSB" etc?

Yes, just read the following post: https://www.mql5.com/en/forum/215391#comment_5738146

My code at that post includes a function "boolRestrictSymbols()" for doing exactly what you described!

EA limit code
EA limit code
  • 2017.09.10
  • www.mql5.com
help me i need to limt my Ea to work under certain accounts that i choose...
forextool
6
forextool  

is it possible to convert demo ea to live? i have a good script

Mohammad Hossein Sadeghi
2042
Mohammad Hossein Sadeghi  
Alain Verleyen:
It's 10 USD job, you can ask on the freelance section.

 

I believe the minimum budget is now $30.
To add comments, please log in or register