Need help finding compilation error
for (cnt=0;cnt<OrdersTotal();cnt++) { OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); while(OrderClosePrice()==0) //Order Still Open if (OrderType()==OP_SELL) if (Bid>=OrderOpenPrice()+HedgeFactor*Point)//<--- here { PlaceBuyOrder(); //Opens buy order OrderSelect(1); while((Ask-SL*Point>OrderOpenPrice)&& (Ask +TP*Point < Ask+500*Point) ) { winprice=OrderOpenPrice()+TP*Point; looseprice=OrderOpenPrice()-SL*Point; if(Ask>=winprice) PlaceBuyOrder(); if(Ask<=looseprice) PlaceSellOrder(); } } } //---- return(0); }
Your code:
if (Bid>=OrderOpenPrice()+HedgeFactor*Point
{
My fixing:
if (Bid>=OrderOpenPrice()+HedgeFactor*Point)//<--- here
{
OK
OrderSelect(1); <--- wrong
while((Ask-SL*Point>OrderOpenPrice)&& (Ask +TP*Point < Ask+500*Point) )<--- wrong, should be
while((Ask-SL*Point>OrderOpenPrice())&& (Ask +TP*Point < Ask+500*Point) )
I tested - no errors
Send me to PM I'll test it.
I re-checked, the OrderSelect line still had an error which I corrected. I am now getting 0 errors. thanks much. I have a few more lines of code to add, I hope I won't have any problems with those
Can anyone help me find the error in the following script?
I keep getting a "\end of program-unbalanced left parentheses" error .
PlaceBuyOrder() and PlaceSellOrder() are functions I defined and which compile ok.
Would appreciate anyone's help. This is my first attempt at writing a MQL4 program
Thanks in advance
int start()
{
//----
int cnt, TurboMagicNum, total;
double winprice,looseprice;
for (cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
while(OrderClosePrice()==0) //Order Still Open
if (OrderType()==OP_SELL)
if (Bid>=OrderOpenPrice()+HedgeFactor*Point
{
PlaceBuyOrder(); //Opens buy order
OrderSelect(1);
while((Ask-SL*Point>OrderOpenPrice)&& (Ask +TP*Point < Ask+500*Point) )
{
winprice=OrderOpenPrice()+TP*Point;
looseprice=OrderOpenPrice()-SL*Point;
if(Ask>=winprice)
PlaceBuyOrder();
if(Ask<=looseprice)
PlaceSellOrder();
}
}
}
//----
return(0);
}