Has anyone an EA for crossover system?

Does anyone have an Expert advisor for an exponential moving average (EMA) crossover system where the closing price of a 5EMA = 10EMA for any or all instruments? In other words, an intersection of the two moving averages.

Does it send electronic messages and/or SMS to mobile phone, as well as do many other useful things?

If so, please post it.

Thanks.

Why don’t you go to codebase.mql4.com and see if you can find what you’re looking for?

I have checked codebase.mql but can’t find any indicator that suits my requirement.

This should get you started. Simply substitute your desired MA & Settings in place of the iStochastic function. Then you can configure your alerts however you wish. If you want it customized and you’re not willing to learn how to do that, then rentacoder or getafreelancer or something along those lines.


//--------------------------------------------------------------------
// callstohastic.mq4
// The code should be used for educational purpose only.
//--------------------------------------------------------------------
int start()                       // Special function start()
  {
   double M_0, M_1,               // Value MAIN on 0 and 1st bars
          S_0, S_1;               // Value SIGNAL on 0 and 1st bars
//--------------------------------------------------------------------
                                  // Tech. ind. function call
   M_0 = iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,  0);// 0 bar
   M_1 = iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,  1);// 1st bar
   S_0 = iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,0);// 0 bar
   S_1 = iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,1);// 1st bar
//--------------------------------------------------------------------
                                  // Analysis of the situation
   if( M_1 < S_1 && M_0 >= S_0 )  // Green line crosses red upwards
      Alert("Crossing upwards. BUY."); // Alert 
   if( M_1 > S_1 && M_0 <= S_0 )  // Green line crosses red downwards
      Alert("Crossing downwards. SELL."); // Alert 
      
   if( M_1 > S_1 && M_0 > S_0 )   // Green line higher than red
      Alert("Continue holding Buy position.");       // Alert 
   if( M_1 < S_1 && M_0 < S_0 )   // Green line lower than red
      Alert("Continue holding Buy position.");       // Alert 
//--------------------------------------------------------------------
   return;                         // Exit start()
  }
//--------------------------------------------------------------------

Will go and test this.
Thanks and God bless.

Dear Halfalump,

I have copied the EA and compiled it. But unfortunately it keeps giving me “Cannot open callstochastics.ex4 on the GBP/USD, M15” when I tried to attach it to my GBP/USD chart.

Any clues why this is happening? What is the solution to this, please?

Thanks in advance.

Not sure what your problem is. The above code is not specific to any one pair or timeframe. Did you change anything, or simply paste this into MetaEditor and complile it?

I did not just copied the code. I changed all occurrences of 5,3,3 in the following statements to 10,3,3 and then compiled it.
M_0 = iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN, 0);// 0 bar
M_1 = iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN, 1);// 1st bar
S_0 = iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,0);// 0 bar
S_1 = iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,1)

Would that have caused the problem?

Interestingly the code compiled successfully.

OK OK OK

Hi Ben ! you new right ?

So tape on google a stuff call Universal EMA cross, or go in a site call forex-tsd, and look for EMA cross systems.

There are plenty !!! my friend.

Don t waste too much time to code what have been very well coded and documented since years !

then start looking for the mistakes, or the wrong part…any the stuff which make you unhappy. then start modify it and…and share, why not ?

In all the case MA-cross system are very good for trend, but horrifull for sideway situation…

Don’t forget, keep it simple…and auto !

Thanks Mudar.
Will go to forex-tsd and search for the relevant indicators.