Hello All,
I have been manual trading for a few years, looking to automation of a few simple systems and learning programming. I have read through CodersGuru's guide and read a number of posts but cannot work this one out. Its very simple and there is something I am missing. I am just trying to get CodersGuru's NewBar code to work and have spent hours searching around to solve the Compile debug problems.
Here is the code, I am sure it is a simple solution:
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
int lastbar, curbar;
bool NewBar()
{
static datetime lastbar = 0
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return(true);
}
else
{
return(false);
}
}
return(0);
}
//+------------------------------------------------------------------+
The code is from
Alert Once Per Bar | www.metatrader.info sorry its just a copy and paste job, but at the moment I just want it to print some text when a new bar forms on the chart! How hard can it be? Very hard for a new programmer!
The compiling errors I currently get are:
'(' - function definition unexpected - which is at bool NewBar() or (43, 16)
and
'}' - unbalanced parentheses - this is the last one, cant work out where I am going wrong!
Thanks so much for any simple answers, also please say if there is a better way to post code. Sorry for being lazy and asking this, but it has been frustrating me all evening and yes, I have tried searching.
Thanks so much for any answers,
Howard
Edit: Sorry, cant remember how to post code properly!? Screenshot attached.