Olá a todos. Eu gostaria de ajuda com o código. É um alerta cruzado médio móvel que eu adicionei um alerta e comprei um pouco. Se o alerta de e-mail funcionará porque eu continuo recebendo 1 erro quando eu compilar eu não sou positivo. Eu colei o código abaixo
Eu passei pelo código algumas vezes e não consigo identificar o problema. Obrigado pela sua ajuda antecipadamente.
O erro diz ... '\ end_of_program' - parêntesis esquerdo desequilibrado
// ----------------------------------------------- -------------------
//| MACrossEarlyAlert.mq4 |
//| Mariano Silva |
//| |
// ----------------------------------------------- -------------------
#property copyright Mariano Silva
link #property
#property indior_chart_window
//- parâmetros de entrada
extern bool EmailAlert = false;
extern int FastMAPeriod = 50;
extern string Tipo = 0-SMA, 1-EMA;
extern int FastMAType = 1;
extern int SlowMAPeriod = 1;
extern int SlowMAType = 0;
extern int EarlyPips = 15;
extern int ResetAlert = 20;
cor externa LineColor = Laranja;
// ----------------------------------------------- -------------------
//| Função de inicialização do indicador personalizado |
// ----------------------------------------------- -------------------
int init ()
//- indicadores
//-
retorno (0);
// ----------------------------------------------- -------------------
//| Função de desinicialização do indicador personalizado |
// ----------------------------------------------- -------------------
int deinit ()
string LineName;
//-
LineName = StringConenate (FastMAPeriod,, SlowMAPeriod, MA Cross);
ObjectDelete (LineName);
//-
retorno (0);
// ----------------------------------------------- -------------------
//| Função de iteração do indicador personalizado |
// ----------------------------------------------- -------------------
int start ()
//int counted_bars = IndiorCounted ();
double FastMALastBar, SlowMALastBar, PriceToCross, Cross, FastMATest, SlowMATest;
bool AlertEnabled = true;
string LineName = StringConenate (FastMAPeriod,, SlowMAPeriod, MA Cross);
//LineName = StringConenate (FastMAPeriod,, SlowMAPeriod, MA Cross);
//-
if (NewBar ())
FastMALastBar = iMA (NULL, 0, FastMAPeriod, 0, FastMAType, PRICE_CLOSE, 1);
SlowMALastBar = iMA (NULL, 0, SlowMAPeriod, 0, SlowMAType, PRICE_CLOSE, 1);
PriceToCross = Open [0];
Cruz = FastMALastBar-SlowMALastBar;
if (Crossgt; 0,0)
enquanto (Crossgt; 0,0)
PriceToCross = PriceToCross-Point;
FastMATest = CalcMA (FastMAPeriod, FastMAType, PriceToCross, FastMALastBar);
SlowMATest = CalcMA (SlowMAPeriod, SlowMAType, PriceToCross, SlowMALastBar);
Cruz = FastMATest-SlowMATest;
outro
enquanto (Crosslt; 0,0)
PriceToCross = PriceToCross Point;
FastMATest = CalcMA (FastMAPeriod, FastMAType, PriceToCross, FastMALastBar);
SlowMATest = CalcMA (SlowMAPeriod, SlowMAType, PriceToCross, SlowMALastBar);
Cruz = FastMATest-SlowMATest;
ObjectDelete (LineName);
drawLine (PriceToCross, LineName, LineColor, 0);
if (AlertEnabled)
if (MathAbs (Close [0] -PriceToCross) lt; = EarlyPips * Ponto)
Alerta (Perto de, FastMAPeriod,, SlowMAPeriod, MA Cross on, Symbol (),, Período ());
se EmailAlert SendMail (perto de, FastMAPeriod,, SlowMAPeriod, MA Cross on, Symbol (), Período ();
AlertEnabled = false;
outro
if (MathAbs (Fechar [0] -PriceToCross) gt; = ResetAlert * Ponto)
AlertEnabled = true;
//-
retorno (0);
// ----------------------------------------------- -------------------
double CalcMA (int MAPeriod, int MAType, double PriceTest, double LastMA)
MA duplo, pr;
switch (MAType)
caso 0:
MA = -LRB- (LastMA * MAPeriod) -Close [MAPeriod] PriceTest)MAPeriod;
pausa;
caso 1:
pr = 2,0(MAPeriod 1);
MA = PriceTest * pr LastMA * (1-pr);
pausa;
retorno (MA);
void drawLine (double lvl, nome da string, cor Col, int type)
ObjectCreate (nome, OBJ_HLINE, 0, hora [0], lvl);/, hora [0], lvl);
if (tipo == 1)
ObjectSet (nome, OBJPROP_STYLE, STYLE_SOLID);
outro
ObjectSet (nome, OBJPROP_STYLE, STYLE_DOT);
ObjectSet (nome, OBJPROP_COLOR, Col);
ObjectSet (nome, OBJPROP_WIDTH, 1);
Retorna;
bool NewBar ()
static datetime lastbar;
datetime curbar = Tempo [0];
if (lastbar! = curbar)
lastbar = curbar;
retorno (verdadeiro);
outro
retorna falso);