Hi guys.
Im trying to make my first EA. Its simple and all it does is make a popup alert and sound when 2 MA's cross. It however does not work eventhough there was a smiley at the top right of the chart, indicating the EA is working fine.
Attached is my code. Can someone correct my mistakes ?
Thanks in advance guys !!! :-)
//+------------------------------------------------------------------+
//| First MA Indicator.mq4 |
//| Copyright 2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#include <WinUser32.mqh>
bool Question=false;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double sma5, ema20, ema10;
sma5=iMA(NULL,0,5,0,0,0,0);
ema20=iMA(NULL,0,20,0,1,0,0);
ema10=iMA(NULL,0,10,0,1,0,0);
bool loop=true;
while (loop==true)
{
if (sma5==ema20 || sma5==ema10)
{
PlaySound("news.wav");
Question=true;
int ret=MessageBox("Time of important MA CROSSINGS. ARE YOU WATCHING?",
"Question", MB_YESNO|MB_ICONQUESTION|MB_TOPMOST);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Im trying to make my first EA. Its simple and all it does is make a popup alert and sound when 2 MA's cross. It however does not work eventhough there was a smiley at the top right of the chart, indicating the EA is working fine.
Attached is my code. Can someone correct my mistakes ?
Thanks in advance guys !!! :-)
//+------------------------------------------------------------------+
//| First MA Indicator.mq4 |
//| Copyright 2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#include <WinUser32.mqh>
bool Question=false;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double sma5, ema20, ema10;
sma5=iMA(NULL,0,5,0,0,0,0);
ema20=iMA(NULL,0,20,0,1,0,0);
ema10=iMA(NULL,0,10,0,1,0,0);
bool loop=true;
while (loop==true)
{
if (sma5==ema20 || sma5==ema10)
{
PlaySound("news.wav");
Question=true;
int ret=MessageBox("Time of important MA CROSSINGS. ARE YOU WATCHING?",
"Question", MB_YESNO|MB_ICONQUESTION|MB_TOPMOST);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+