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?
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()
}
//--------------------------------------------------------------------
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?
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)