Quote:
|
Originally Posted by pikachucom
Yes I am. Interbank FX
I only want the EA to email me when these peramiters cross.
RSI (8) crosses 50% Line
Moving Average Simple Crossover
5 Period
3 Period
Using a 4 hour bar chart
thanks
|
It looks like the start function was ended prematurely, and the server address validation string needed to be changed from InterbankFX-Demo to InterbankFX-Demo Accounts. Try this:
PHP Code:
//+------------------------------------------------------------------+
//| Email_Alert2_RSIMA.mq4 |
//| Eric Hamilton |
//| http://www.interbankfx.com |
//+------------------------------------------------------------------+
#property copyright "Eric Hamilton"
#property link "http://www.interbankfx.com"
#include <stdlib.mqh>
#define MAGIC 3333
//+---------------------------------------------------+
//|Indicators RSI, MA Crossover
//|
//|
//+---------------------------------------------------+
extern int RSIPeriod=8;
extern int RSIPrice=PRICE_CLOSE;
extern int MAFastPeriod=3;
extern int MAFastShift=0;
extern int MAFastMethod=MODE_SMA;
extern int MAFastPrice=PRICE_CLOSE;
extern int MASlowPeriod=5;
extern int MASlowShift=0;
extern int MASlowMethod=MODE_SMA;
extern int MASlowPrice=PRICE_CLOSE;
bool runnable=true;
bool initialize=true;
datetime timeprev=0;
int init()
{
return(0);
}
int deinit()
{
return(0);
}
int start(){
//Runnable
if(runnable!=true)
return(-1);
//Init
// if(initialize==true){
// initialize=false;
if(!InterbankFXServer()){
runnable=false;
return(-1);
}//
//
//New Bar
//
if(timeprev==Time[0])
return(0);
timeprev=Time[0];
//
//Calculation
//
double
fast01=iMA(NULL,0,MAFastPeriod,MAFastShift,MAFastMethod,MAFastPrice,1);
double
fast02=iMA(NULL,0,MAFastPeriod,MAFastShift,MAFastMethod,MAFastPrice,2);
double
slow01=iMA(NULL,0,MASlowPeriod,MASlowShift,MASlowMethod,MASlowPrice,1);
double
slow02=iMA(NULL,0,MASlowPeriod,MASlowShift,MASlowMethod,MASlowPrice,2);
double
rsi01=iRSI(NULL,0,RSIPeriod,RSIPrice,1);
double
rsi02=iRSI(NULL,0,RSIPeriod,RSIPrice,2);
//Long
if(fast01>slow01&&fast02<slow02){
SendMail("MA Cross Long","MAs crossed to go LONG "+TimeToStr(Time[0],TIME_DATE)+" "+TimeToStr(Time[0],TIME_MINUTES));
}
if(rsi01>50&&rsi02<50){
SendMail("RSI Cross Long","RSI crossed 50% to go LONG "+TimeToStr(Time[0],TIME_DATE)+" "+TimeToStr(Time[0],TIME_MINUTES));
}//Shrt
if(fast01<slow01&&fast02>slow02){
SendMail("MA Cross Shrt","MAs crossed to go SHORT "+TimeToStr(Time[0],TIME_DATE)+" "+TimeToStr(Time[0],TIME_MINUTES));
}
if(rsi01<50&&rsi02>50){
SendMail("RSI Cross Shrt","RSI crossed 50% to go SHORT "+TimeToStr(Time[0],TIME_DATE)+" "+TimeToStr(Time[0],TIME_MINUTES));
}
}
bool InterbankFXServer() {
Comment(ServerAddress());
if(ServerAddress()=="InterbankFX-Server"||ServerAddress()=="InterbankFX-Demo Accounts"||ServerAddress()=="66.114.105.89"){
// Comment("Server Matches");
return(true);
}else{
return(false);
}
}//bool InterBanFXServer()