Need help about a short code on MAs

 

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. 

 
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
 

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. 

 

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, 

 

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 

 

Thank you, mrluck1! 

Mohammad, I wonder if you have any idea.

 
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 

 
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
 

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 


 
Thank you, all!!
Reason: