Errors, bugs, questions - page 149

 
Vladix:

Put a delay - yes, I accept, how many lines of code would it take to do that? And if it's a multi-currency, it needs to account for the delay on each one, doesn't it?

I wrote the code that solves this. Only I don't like it, just as, sorry, I don't like yours. And it's not about bias, the point is that there are no other options, simple and elegant.

I've got two lines on the multicurrency in the block for the trade request. That's it... If you need to open an order, check whether the current time is not more than the cut-off time. There is nothing more elegant, and both are absolutely reliable...

if(типдействия==TRADE_ACTION_DEAL || типдействия==TRADE_ACTION_PENDING)
    ВремяОкончанияЗапрета[i3]=TimeCurrent()+СекундыЗадержкиПослеЗапроса;
 
Vladix:

Put a delay - yes, I accept, how many lines of code would it take to do that? And if it's a multi-currency, it needs to account for the delay on each one, doesn't it?

I wrote the code that solves this. Only I don't like it, just as, sorry, I don't like yours. It's not a matter of bias, the point is that there are no other simple and elegant solutions.


Delay is not our method))

1. We should memorize the number of positions(or orders) into a variable (static or global) before we make a trade operation.

2. In case of non-execution, the variable=-1;

In the case of successful execution, we wait, do nothing, and check on every tick until the number of positions (or orders) is equal to the variable.

3. When it is not equal - variable=-1;

Документация по MQL5: Торговые функции / PositionsTotal
Документация по MQL5: Торговые функции / PositionsTotal
  • www.mql5.com
Торговые функции / PositionsTotal - Документация по MQL5
 
Swan:

Delay is not our method))

1. Before a trade operation, store in a variable (static or global) the number of positions(or orders)

Are they open? The position is the same for each instrument.... You cannot fill or partially close it. The amount will be the same. And it is not acceptable to re-calculate the number of orders in the history... you do not know where they may come from...
 
Swan:

Delay is not our method))

1. Before a trade operation, we save the number of positions(or orders) into a variable (static or global)

2. In the case of non-execution - variable=-1;

In the case of successful execution, we wait, do nothing, and check on every tick until the number of positions (or orders) is equal to the variable.

3. As soon as it is no longer equal, variable=-1;

Not a method - only for pips, but for medium-term trading it's OK. Otherwise, we risk running into


10024

TRADE_RETCODE_TOO_MANY_REQUESTS

Too frequent requests

with possible prohibition to trade the Expert Advisor.

 
Dmitriy2:
Is it open? The position is the same for each instrument.... You cannot fill or partially close it... the amount will be the same. And it is not acceptable to re-calculate the number of orders in the history... you don't know where they may come from...

Yeah, I know) we should write in a variable what should be changed as a result of OrderSend().

If you close completely/(or open a new one) it will change the total number of poses (although, yes, it is enough, and it seems more reliable, and is/is not a pose by symbol to remember). It may also remember the volume, and it will work when adding/removing positions.

When setting/removing a pending order - the number of orders (can be calculated using the symbol).


In general: a little imagination and adding just one variable, per type of trade operation, will make your code more reliable, simple and elegant :)

 
Valmars:

Not a method - only for pips, but for medium-term trading - a normal method. Otherwise we risk to run into


10024

TRADE_RETCODE_TOO_MANY_REQUESTS

Too frequent requests

Otherwise we risk to be banned from trading the Expert Advisor.


that's a little different, it was like this in 4:

ERR_TOO_MANY_REQUESTS 141 Too many requests. You need to reduce the frequency of requests and change the program logic.

You have to try very hard to get this error, or you may have an account in a smart brokerage company :)

Slip is a normal method for some errors, in other cases it looks a little bit crooked.

 
Swan:

it's a bit different, it was like that in 4:

you have to try really hard to make that mistake, or have a dodgy DC account :)

Slip is a normal method for some errors, in other cases it looks a bit crooked.


I don't know.

Here, it even says in the terminal manual:

  • Trailing Stop can not trigger more than one position every 10 seconds. That is, the terminal sets such a delay. And trailing stop is automatically processed on the server.
 
Valmars:

I don't know...

Here, it even says in the terminal manual:

  • Trailing Stop cannot trigger more than one position every 10 seconds. I.e., the terminal sets such a delay. And trailing stop is automatically processed on the server.
On a five-digit tick it is really not necessary to move every stop. But it doesn't mean that if trailing stops every 10 seconds - other trades are prohibited.


That's not what I mean :)

Vladix:

Generally speaking, the problem is this:

a tick comes, the indicator shows that it needs to close, I close

the next tick comes, the indicator shows that it should close and I do not know what to do - the position is already overwritten and what happens to it at the moment, of course, can be found out, but via the fifth point.

In this case, you just need to determine that the position information was updated, without using the fifth point, preferably)

Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Типы торговых операций
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Типы торговых операций
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Типы торговых операций - Документация по MQL5
 

Developers.

In MQL help, there is no ENUM_CHART_VOLUME_MODE in Index tab. Add it...

 
Swan:

In general: a little imagination and the addition of just one variable, per trade operation type, will make your code more robust, simple and elegant :)

So, fantasize exactly what code the man needs that would be 10 lines long and reliable, like mine, and that he would like it :)

And speaking of elegance you suggest to make a pile with unclear logic from two lines that are absolutely and logically fulfilling the task you're asking...

Swan:

Delay is not our method))

In the case of execution we wait... ...3. yak not equal...

And wait for how long? Doesn't that count as a delay? And if it never becomes "not equal"? And we're waiting by the weather... A trade request can easily return a troue and not actually be fulfilled...