''crossed - function not defined'' ...please help!

[Deleted]  

Hi there,

I have programmed a simple ema as a start to get into MQL4 programming but have run into a snag.

I get an error message saying corssed - function not defined on the following section of code:



sEma = iMA(NULL,0,21,0,MODE_EMA,PRICE_CLOSE,0);
lEma = iMA(NULL,0,55,0,MODE_EMA,PRICE_CLOSE,0);
//----------

int isCrossed = Crossed (sEma,lEma);



so I added the following code :

static int isCrossed = 0;


(like this into the EA...)

sEma = iMA(NULL,0,21,0,MODE_EMA,PRICE_CLOSE,0);
lEma = iMA(NULL,0,55,0,MODE_EMA,PRICE_CLOSE,0);
//----------

static int isCrossed = 0;
int isCrossed = Crossed (sEma,lEma);

total = OrdersTotal();
if (total < 1)
{
if (isCrossed == 1)
{



then when I compile the EA it says ..."crossed - variable Already defined"



please help me understand what Im doing wrong and How to fix it.


Iv attached a copy of the entire code if anyone needs to see it to understand what im doing.

thanx

Rory Kruger

[Deleted]  
RK

1) You have declared the variable name isCrossed in two places, if you need a static copy of the value, call it sisCrossed

2) Cant see a function Crossed anywhere - does it exist? The attached code is not visible to me :(


Keep trying :)

Then try some more ;)

-BB-

[Deleted]  
Thanx BarrowBoy, Ill try that. Ill put the whole code below for future referance.

thanx again,.