EMA Cross Price[URGENT]

 

Hi,

i am writing a EA to calculate the cross price for EMA. How can i determine at what price the crossover has taken place???

Basially, how does one track if the 5 EMA has crossed over the 20 EMA...???

1.Ema period=5 with shift of -1

>>> 2.Ema period= 20 (no shift)

Open -Close-Open (reverse position)

Open- Close- New order...could be several orders inside a bar

If Requote, always a YES

[Deleted]  

What makes your message "urgent"?

 

Because he can't wait to be rich!

[Deleted]  

The actual answer to his question is very simple. However, it ticked me off to see the first post by a member marked as urgent.

 

Was marked urgent as a 6 month Testbench results are to be compared with and posted here.

 
rajatnaik:
Hi,

i am writing a EA to calculate the cross price for EMA. How can i determine at what price the crossover has taken place???

Basially, how does one track if the 5 EMA has crossed over the 20 EMA...???

1.Ema period=5 with shift of -1

>>> 2.Ema period= 20 (no shift)

Open -Close-Open (reverse position)

Open- Close- New order...could be several orders inside a bar

If Requote, always a YES

For EA so: if price close so ma with 0 is crossing ma with 0. And one bar ago (+1 bar if it is close mode) ma is below or above the other ma with 1 bar as well.

If ma with other mode (not close price mode) so it is 1 and 2.

- (minus) 1 bar is the future.

"Future is not set". We have a thread with this "Future is not set" indicator (based on tartan's indicator for Goldwarrior EA).

There are a lot of EAs developed on this forum concerning MA crossing. As I remember Codersguru developed some EMA crossing EAs - look here https://www.mql5.com/en/forum/trading_systems

Besides there is thread with 3 EMA crossing EA here.

You may take it from this examples (attached):

1. MA_ExpertProfit.mq4: it is the same EA but it will close the orders in s/l or t/p only.

2. MA_ExpertProfit_all.mq4: it will close the order on s/l or t/p, or on the other crossing signal. This EA should work on particular account only. Just change the line "int Account = 111111;" to your account number inside the code. For example your account is 1235463. So this line should be like this:

int Account = 1235463;

3. MA_ExpertProfit_noacc.mq4: it is the same with item # 2. But without any account and it may work in any account (i mean account in Metatrader).

And check this very good thread as well https://www.mql5.com/en/forum/general

 

Need help making first Expert Advisor

So im trying to learn mql 4, but i have some problems, and i would like to look off a code so i can learn it that way

This is the rules it should have

If close above EMA 7 (Buy)

If close under EMA 7 (Sell and Sell short)

If close above EMA 7 (Buy to cover and buy)

How can i make that?

 

...

Mathias

Honest to god, when I read this I though that the result is going to go straight down. But since it is not (to my surprise - at 15 minute EURUSD) posting the EA that works as you described it (be aware it is not a winner either and the logic of it needs to be worked on more, but the attached EA you can use as a starting point). As the name suggests, it is as simple as it gets and I hope it will help you in further development

regards

Mathias:
So im trying to learn mql 4, but i have some problems, and i would like to look off a code so i can learn it that way

This is the rules it should have

If close above EMA 7 (Buy)

If close under EMA 7 (Sell and Sell short)

If close above EMA 7 (Buy to cover and buy)

How can i make that?
Files:
simple_ea.mq4  3 kb