Invalid request - just started and can't figure it out...

 

Hello.

I can't figure out what he wants...

Trying to correct SL and TP and it says this:

2012.09.20 14:06:39 Trades '1262357': failed modify buy 0.00 sl: 0.00000, tp: 0.00000 -> sl: 1.29411, tp: 1.29531 [Invalid request]

What do I have to do?

 
sotic: I can't figure out what he wants...

Trying to correct SL and TP and it says this: 2012.09.20 14:06:39 Trades '1262357': failed modify buy 0.00 sl: 0.00000, tp: 0.00000 -> sl: 1.29411, tp: 1.29531 [Invalid request]
What should I do???

Figure out the code. Especially when only zeros are modified: buy 0.00 sl: 0.00000, tp: 0.00000
 

Sorry about that.

I forgot to specify the item - request.symbol=PositionGetSymbol(i)

Thank you...

 
sotic: I'm sorry.
Yes, no problem.
 

Another question then.

How do you close a part of a lot in EA, not the whole lot?

:)

 
sotic: Another question, how do you close a part of a lot in an Expert Advisor, rather than the whole lot?)

If you have an open position, you can reduce the size of that position by placing an opposite order with the required size.

There are several topics for newbies here - you can ask such questions right there.

 

How about this?

Trades 01:47:23 2010.07.02 19:14:59 failed instant buy 0.10 EURUSD at 1.25953 sl: 1.25640 tp: 1.26253 [Invalid request]

OE 0 111 (EURUSD,H1) 01:47:23 2010.07.02 19:14:59 Alert: Request to place Buy order failed - error code:4756

Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений
Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений
  • www.mql5.com
Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений - Документация по MQL5
 
Forex_Noob:

How about this?

Trades 01:47:23 2010.07.02 19:14:59 failed instant buy 0.10 EURUSD at 1.25953 sl: 1.25640 tp: 1.26253 [Invalid request]

OE 0 111 (EURUSD,H1) 01:47:23 2010.07.02 19:14:59 Alert: Request to place Buy order failed - error code:4756

Did you remember to null the request structure before using it?

MqlTradeRequest mrequest={0};
 
Forex_Noob: But what if it reads like this?

Trades 01:47:23 2010.07.02 19:14:59 failed instant buy 0.10 EURUSD at 1.25953 sl: 1.25640 tp: 1.26253 [Invalid request]

OE 0 111 (EURUSD,H1) 01:47:23 2010.07.02 19:14:59 Alert: Request to place Buy order failed - error code:4756

You need to check the appropriate code.
 
We need to somehow promote the Standard Library to the masses.

Sending queries with filling structures is a perversion with a lot of pitfalls.
In mql4, jforex, ninjatrader it's done humanly, but in mql5 they decided to bring some low-level api - that's good.
But the fact that newcomers stumble on structures with a lot of fields to buy 1 lot in the market or close a position is too bad.

And article writers are happy to try not to use human-friendly ways (Standard Library) but push beginners into ancient C-based constructs.

 
mrProF: We need to promote the standard library to the masses somehow.

Extremely controversial.

mrProF:. No, we should use the human-friendly way (Standard Library).

Standard library as a "human-friendly way" - no comments.

Reason: