Since you define Trend to be a bool and you want to assign a boolean value to this variable, the function fnIndTrendDirection(candles) should be delcared as bool.
So you have and no int declartion here allowed
Trend= fnIndTrendDirection(candles);
and make sure your fucntion is declared as follows
bool fnIndTrendDirection(int candles)
{
your codes
return(answer);
}
where answer is either true or false
Since you define Trend to be a bool and you want to assign a boolean value to this variable, the function fnIndTrendDirection(candles) should be delcared as bool.
So you have and no int declartion here allowed
Trend= fnIndTrendDirection(candles);
and make sure your fucntion is declared as follows
bool fnIndTrendDirection(int candles)
{
your codes
return(answer);
}
where answer is either true or false
Hi Ronaldo,
Thanks for the advise, I'm more confused mow then before. But that was mot my question though, please reread.....
Thanks
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
This is my first try at coding an EA, i'm not a programmer, and I have a lot of problems with compile errors.
I'm fiddling around trying to figure out how "functions" work, so I'm trying to write a very basic one and figure out by my mistakes but it keeps telling me that "EXPRESSION ON GLOBAL SCOPE NOT ALLOWED" could someone tell me what is going on?
Here is my code, i'd like to know WHY this is happening, what I'm doing wrong.
Thanks
Roger
______________________________________________________________________________________________________
#property copyright "test"#property link "test"
//+------------------------------------------------------------------+
//| External variables |
//+------------------------------------------------------------------+
extern double Lots = 0.10;
extern double StopLoss = 100;
extern double TakeProfit = 10.00;
extern double TrailingStop = 5.00;
extern double LotSize = 0;
//+------------------------------------------------------------------+
//| Global variables |
//+------------------------------------------------------------------+
int candles=0;
bool Trade=False;
bool BULL=False;
bool BEAR=False;
bool Trend=False;
string result="";
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
Trend=int fnIndTrendDirection(candles);
fnTrade(LotSize,StopLoss,TakeProfit,Trend);
if Trend=BULL,result="BUY";{
if Trend=BEAR,result="SELL";
}
Alert ("Just made a ",result);
return(0)
}
Thank You very much for your help.
Roger