WHAT IS WRONG WITH THIS CODE ????????

 

I'm doing some testing and I cant figure out why I get "unbalanced parentheses" on this.


Could someone be kind enough to tell me why I get this error from the compiler?


____________________________________________________________________

extern double LotSize=0.01;
extern int StopLoss=25;
int EA_Magic=123456;
bool BULL=false;
bool BEAR=false;

int init()
{
return(0);
}
int deinit()
{
return(0);
}

//=================================================================|
// ---- FUNCTION "IndTrendDirection" ---- |
//=================================================================|


bool IndTrendDirection()

{
int IndH=High[iHighest(NULL,0,MODE_HIGH,100,0)]; //-- I GET HIGH POINT
int IndL=High[iLowest(NULL,0,MODE_LOW,100,0)]; //-- I GET LOW POINT
int TrendDirection = double fnTrendDir(IndH,IndL); //-- I CALL THIS FUNCTION "fnTrendDir"
return (TrendDirection);
}

//=================================================================|
// ---- THIS FUNCTION WILL DETERMINE IF MARKET BULL OR BEAR ---- |
//=================================================================|

double Diff=0;
double DistH;
double DistL;

double fnTrendDir(double IndH,double IndL)

{
Diff = IndH - IndL;
DistH = IndH - Bid;
DistL = Bid - IndL;
if (DistH < DistL && DistH <= 5) BULL = True;
return(BULL);

}


//=================================================================|
// ---- PRINT COMMENT ON MARKET DIRECTION ---- |
//=================================================================|

int start()

{
if (IndTrendDirection()== BULL);

{
int Direction=0;
Comment("Direction of Trend = ",Direction};
}
return(0);

}

______________________________________________________________________________________


I'm just practicing (as you can see).


Thanks

 
Micky52 wrote >>

I'm doing some testing and I cant figure out why I get "unbalanced parentheses" on this.

Could someone be kind enough to tell me why I get this error from the compiler?

____________________________________________________________________

extern double LotSize=0.01;
extern int StopLoss=25;
int EA_Magic=123456;
bool BULL=false;
bool BEAR=false;

int init()
{
return(0);
}
int deinit()
{
return(0);
}

//=================================================================|
// ---- FUNCTION "IndTrendDirection" ---- |
//=================================================================|


bool IndTrendDirection()

{
int IndH=High[iHighest(NULL,0,MODE_HIGH,100,0)]; //-- I GET HIGH POINT
int IndL=High[iLowest(NULL,0,MODE_LOW,100,0)]; //-- I GET LOW POINT
int TrendDirection = double fnTrendDir(IndH,IndL); //-- I CALL THIS FUNCTION "fnTrendDir"
return (TrendDirection);
}

//=================================================================|
// ---- THIS FUNCTION WILL DETERMINE IF MARKET BULL OR BEAR ---- |
//=================================================================|

double Diff=0;
double DistH;
double DistL;

double fnTrendDir(double IndH,double IndL)

{
Diff = IndH - IndL;
DistH = IndH - Bid;
DistL = Bid - IndL;
if (DistH < DistL && DistH <= 5) BULL = True;
return(BULL);

}


//=================================================================|
// ---- PRINT COMMENT ON MARKET DIRECTION ---- |
//=================================================================|

int start()

{
if (IndTrendDirection()== BULL);

{
int Direction=0;
Comment("Direction of Trend = ",Direction};
}
return(0);

}

______________________________________________________________________________________

I'm just practicing (as you can see).

Thanks

hi

may be in this line last character :

Comment("Direction of Trend = ",Direction};

 

Comment("Direction of Trend = ",Direction};
must be:

Comment("Direction of Trend = ",Direction);

 
Roger:

Comment("Direction of Trend = ",Direction};
must be:

Comment("Direction of Trend = ",Direction);

THANK YOU very much Guys, How stupid of me, I guess I should rest my eyes for a while LOL

Thanks again

 
Micky52:

THANK YOU very much Guys, How stupid of me, I guess I should rest my eyes for a while LOL

Thanks again


What about this error 130?



//=================================================================|
//---------------- OPEN ------------------|
//=================================================================|
void OpenNew(string Type)

{
OpenTrades=OrdersTotal();

Alert ("Entering OPEN with = ",Type," MaxTrades = ",MaxTrades," - Open = ",OpenTrades );
OrderSelect(OrderTicket(),SELECT_BY_POS,MODE_TRADES);

if (MaxTrades==OpenTrades)
return(0);

else
Alert ("Entering ELSE for type ",Type );
{
if (Type=="BULL")
Alert ("Placing Order for a BULL");
int trade=OrderSend(Symbol(),OP_BUY,LotSize,Bid,Slipp,StopLoss*Point,TakeProfit*Point,0,0,Blue);
OpenTrades +=1;
}
return(0);
{
if (Type=="BEAR")
Alert ("Placing Order for a BEAR" );

trade=OrderSend(Symbol(),OP_SELL,LotSize,Ask,Slipp,StopLoss*Point,TakeProfit*Point,0,0,Red);
OpenTrades +=1;
Alert ("Exiting OPEN with = ",Type,"MaxTrades = ",MaxTrades," - Open = ",OpenTrades );
}
return(0);
}

_________________________________________________________________________________________________________________________

10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Exiting CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: START
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnIndTrendDirection()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnTrendDir()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering OPEN with = BEAR MaxTrades = 20 - Open = 0
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering ELSE for type BEAR
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: OrderSend error 130
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Exiting CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: START
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnIndTrendDirection()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnTrendDir()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering OPEN with = BEAR MaxTrades = 20 - Open = 0
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering ELSE for type BEAR
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: OrderSend error 130
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Exiting CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: START
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnIndTrendDirection()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnTrendDir()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering OPEN with = BEAR MaxTrades = 20 - Open = 0
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering ELSE for type BEAR
_____________________________________________________________________________________________________________________________


I have a lot of Alerts in there so I can follow the code when running it.

Whats wrong with this OrderSend command?


Thanks

 
Micky52 wrote >>

What about this error 130?


//=================================================================|
//---------------- OPEN ------------------|
//=================================================================|
void OpenNew(string Type)

{
OpenTrades=OrdersTotal();

Alert ("Entering OPEN with = ",Type," MaxTrades = ",MaxTrades," - Open = ",OpenTrades );
OrderSelect(OrderTicket(),SELECT_BY_POS,MODE_TRADES);

if (MaxTrades==OpenTrades)
return(0);

else
Alert ("Entering ELSE for type ",Type );
{
if (Type=="BULL")
Alert ("Placing Order for a BULL");
int trade=OrderSend(Symbol(),OP_BUY,LotSize,Bid,Slipp,StopLoss*Point,TakeProfit*Point,0,0,Blue);
OpenTrades +=1;
}
return(0);
{
if (Type=="BEAR")
Alert ("Placing Order for a BEAR" );

trade=OrderSend(Symbol(),OP_SELL,LotSize,Ask,Slipp,StopLoss*Point,TakeProfit*Point,0,0,Red);
OpenTrades +=1;
Alert ("Exiting OPEN with = ",Type,"MaxTrades = ",MaxTrades," - Open = ",OpenTrades );
}
return(0);
}

_________________________________________________________________________________________________________________________

10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Exiting CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: START
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnIndTrendDirection()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnTrendDir()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering OPEN with = BEAR MaxTrades = 20 - Open = 0
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering ELSE for type BEAR
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: OrderSend error 130
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Exiting CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: START
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnIndTrendDirection()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnTrendDir()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering OPEN with = BEAR MaxTrades = 20 - Open = 0
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering ELSE for type BEAR
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: OrderSend error 130
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Exiting CLOSE
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: START
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnIndTrendDirection()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: into fnTrendDir()
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering OPEN with = BEAR MaxTrades = 20 - Open = 0
10:57:18 2008.11.03 01:00 fUNCTION TESTTTTttttt EURUSD,M5: Alert: Entering ELSE for type BEAR
_____________________________________________________________________________________________________________________________

I have a lot of Alerts in there so I can follow the code when running it.

Whats wrong with this OrderSend command?

Thanks

The stops are not calculated correctly:

Stoploss and takeprofit in OrderSend must be [open price]+/-[StopLoss/TakeProft]*Point

i.e. for an open price of 1.5465 and stops of 50 pips, they should be 1.5415 and 1.5515

jdc

 
jingodelcuyo:

The stops are not calculated correctly:

Stoploss and takeprofit in OrderSend must be [open price]+/-[StopLoss/TakeProft]*Point

i.e. for an open price of 1.5465 and stops of 50 pips, they should be 1.5415 and 1.5515

jdc

Of course Jingo.

What an oversight of my part.

Thanks a lot

Roger