Please help !!!

 

Hi,

I'm writing the simplest code I can but I always get error "Invalid price" when tring opening a position !!!

ex:

if (OrdersTotal() == 1) return;

res=OrderSend(Symbol(),OP_SELL,Lots, Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"",100,0,Red);

if(res<0)

{

Print("OrderSend SELL failed with error: ",GetLastError());

}

What can be simple than that ???

And always, for all symbols, I get error 129 !!!

Why ???

 

I used this code in Volume Trader:

if ( Volume[1] < Volume[2] )

{

OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,cm,EAMagic,0,White);

}

if ( Volume[1] > Volume[2] )

{

OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,cm,EAMagic,0,Red);

}

https://www.mql5.com/en/forum

Your problems seems to be related to stoploss and take profit.

Try with 0 and if it works, try modifying TakeProfit and StopLoss ... and ... try to show them with an Alert (perhaps value is wrong).

 

I had the same problem with Brainwashing EAs all the day yesterday:

- Brainwashing #1c USDCHF,M15: Error opening order : invalid price.

Now I know that it might be the following:

- price is moving too fast - slippage. (yesterday especially);

- MT4 build 185 have a bug (big one!).

I uploaded MetaTrader to build 186 and everything is ok now.

Yaniv_av, I think you are using MetaTrader build 184 or 185.

 
newdigital:
Yaniv_av, I think you are using MetaTrader build 184 or 185.

Or takeprofit/stoploss is very small value

 
forexts:
Or takeprofit/stoploss is very small value

Yes of course. It may be the reason as well.

 

I think there was a problem with the prev build

that released before a few hours.

I have downloaded the last build released now and it's ok ...

10X all !

Reason: