Download MetaTrader 5

Need help about a short code on MAs

To add comments, please log in or register
Murat Yazici
1234
Murat Yazici  

Hi,

I have an Expert Advsor. It uses two MAs to open a position. Forexample; if MA22>MA55 than open a buy position, if MA22<MA55 than open a sell position., simply.

I want to add a condition in this expert.

If MA22>MA55 and the price >MA100 than open a buy position

if MA22<MA55 and the price <MA100 than open a sell position

Can you help me, please?

Thank you so much!!

Murat Y. 

Mohammad Soubra
30929
Mohammad Soubra  
muratyazici:

Hi,

I have an Expert Advsor. It uses two MAs to open a position. Forexample; if MA22>MA55 than open a buy position, if MA22<MA55 than open a sell position., simply.

I want to add a condition in this expert.

If MA22>MA55 and the price >MA100 than open a buy position

if MA22<MA55 and the price <MA100 than open a sell position

Can you help me, please?

Thank you so much!!

Murat Y. 

Please place your code here to allow us modify it
Murat Yazici
1234
Murat Yazici  

Hi,

I try to explain simply. However my EA's code is so big for this area.

The expert uses MAs, SAR, MACD, Stochastic etc. If you have time to looat my EA, can you write me your email address, please?

I want to add a condition in the EA;

if the price < MA100 than open a sell or a buy position.

Murat Y. 

Murat Yazici
1234
Murat Yazici  

I wonder how can I write this condition with mql4.

If I have an idea with your helps, I try to write codes in my EA.

the price < MA100

how can I describe the current price with MQL4?

Best, 

mrluck1
630
mrluck1  

you can put Bid or Ask, so if (Ask < MA100)

                                              { ...}

 If you read mql4 book you'll see a lot of good examples and explained 

https://book.mql4.com/operators/if 

Murat Yazici
1234
Murat Yazici  

Thank you, mrluck1! 

Mohammad, I wonder if you have any idea.

Mohammad Soubra
30929
Mohammad Soubra  
muratyazici:

Thank you, mrluck1! 

Mohammad, I wonder if you have any idea.

Close[0];

Or:

double  iClose(
   string           symbol,          // symbol
   int              timeframe,       // timeframe
   int              shift            // shift
   );


 

the above could help in your case...

it will access the price that you have referred to. 

but again place your code, not all but that area at least 

Mohammad Soubra
30929
Mohammad Soubra  
mrluck1:

you can put Bid or Ask, so if (Ask < MA100)

                                              { ...}

 If you read mql4 book you'll see a lot of good examples and explained 

https://book.mql4.com/operators/if 

Very Good
Mohammad Soubra
30929
Mohammad Soubra  

Opening a new job and hiring a coder would give you more quality in short time and you could learn as well

in addition, you can ask for more advanced requirements. 

https://www.mql5.com/en/job/new 


Murat Yazici
1234
Murat Yazici  
Thank you, all!!
Mohammad Soubra
30929
Mohammad Soubra  
MQL5 Code Base
MQL5 Code Base
  • www.mql5.com
MQL5 Source Code Library for MetaTrader 5
To add comments, please log in or register