Discussion of article "Library for easy and quick development of MetaTrader programs (part X): Compatibility with MQL4 - Events of opening a position and activating pending orders" - page 5

 
Alexey Viktorov:

Modifail only one, highlighted position. There's no doubt about that. It was set this morning. Modified it several times. I didn't care which one I modified. I had already set a takeout on this one. That's what I was trying to do.

Here are all the limiters and the last Sell.

The deleted limiters and the Sell are highlighted. Apparently, there is a deletion event somewhere. But why did it "wake up" not with the opening of this Sell, but only with the closing?

At 15:01:14 I deleted the limit order placed earlier.

Until 18:29 I did my own business. The Expert Advisor stood on the chart.

At 18:29:21 I modified the previously set position.

At 18:33:02 I put Sell

At 18:34:11, I closed this Sell.

"Previously opened position" - was it opened before the"previously set limit order" was set?

Yes, or no?

Alexei, is it hard to answer briefly without a bunch of journal posts?

  1. open position, set order
  2. set order, open position.

You have them all labelled as "previously opened" and "previously set".

Which is correct: 1 or 2 ?

 

Watch your hands:

A Buy position was placed at 8:51 and has not been closed. Even now it's open. Only changed the take level a few times. Here's a record of it.

443218277 2019.05.27 08:51:53 buy 0.01 eurusd 1.12112 0.00000 1.12218   1.11933 0.00 0.00 0.00 -1.79

Limiter at 14:54 (no seconds) placed. At 15:01 it was removed. Which was recorded at the appropriate time.

443342388 2019.05.27 14:54:10 buy limit 0.01 eurusd 1.11835 0.00000 0.00000 2019.05.27 15:01:14 1.11972 cancelled 


Further, after the break, the take level of the Buy position placed at 8:51 was changed a couple of times again.

At 18:33 the Sell position was opened and at 18:34 it was closed.

443417294 2019.05.27 18:33:02 sell 0.01 eurusd 1.11912 0.00000 0.00000 2019.05.27 18:34:11 1.11933 0.00 0.00 0.00 -0.21

It was at the moment of closing this Sell position that there was a repeated message about the removal of the limit set at 14:54 and removed at 15:01.

 
Alexey Viktorov:

Watch your hands:

A Buy position was placed at 8:51 and has not been closed. Even now it's open. Only changed the take level a few times. Here's a record of it.

Limiter at 14:54 (no seconds) placed. Removed at 3:01 p.m. Which was recorded at the appropriate time.


Further, after the break, the level of the take level of the Buy position placed at 8:51 was changed a couple of times again

At 18:33 the Sell position was opened and at 18:34 it was closed.

It was at the moment of closing this Sell position that there was a repeated message about the removal of the limit set at 14:54 and removed at 15:01.

so

  1. a Buy position was opened.
  2. Limit order was set
  3. Buy position takek was changed
  4. Limit order removed
  5. Buy position takek changed
  6. Sell position was opened
  7. Sell position closed

Is that the sequence?

I'm asking you to just write a sequence of actions, not to shove your logs for me to spend half a day in them - I can't get a simple sequence of actions from you for half a day now - you keep trying to give me your logs to deal with - Alexey, I have a lot of worries. I just need to reproduce your situation. To do that, I need the usual sequence of actions as I wrote above - it takes me five minutes to write, and I don't have to sort out the intricacies of your log, scrapped and posted in chunks here.

I can't reproduce your error. That's why I'm asking for quick help, rather than making me go through your log scattered through posts.

 
Artyom Trishkin:

hence

  1. a Buy position has been opened
  2. limit order was set
  3. Buy position takek was changed
  4. Limit order removed
  5. Buy position takek was changed
  6. Sell position was opened
  7. Sell position closed

Is this the sequence?

The highlighted was repeated several times. How many, I don't know, I didn't need to count it. I don't think you know how it affects the whole situation.

But in general, it's exactly like this.

 
Alexey Viktorov:

The highlighted part was repeated many times. How many, I don't know, I didn't have to count it. I don't think you know how it affects the whole situation.

But in general, it's exactly like that.

And now a question about the logs: is there an entry in the log about p4"Limit order deleted" after the entry about the Buy takeout change from p3 ?

Why is it necessary - to understand whether this event was lost the first time when the order was deleted, or whether it was re-displayed after Sell close

 
Artyom Trishkin:

And now a question about the logs: is there an entry in the log about p4"Limit order deleted" after the entry about the Buy takeout change from p3 ?

Why is it necessary - to understand whether this event was lost the first time when the order was deleted, or whether it was re-displayed after Sell close

You see how useful it is to dig through logs)))))) Between placing this order and deleting it, I moved it three more times to a different price.

And the record of deletion was

15:01:14.249    00 EURUSD,H1: - Отложенный ордер удалён: 2019.05.27 14:54:10.000 - EURUSD Удалён 0.01 Buy Limit #443342388  по цене 1.11835
 
Alexey Viktorov:

You can see how useful it is to dig through the logs.)))))) Between placing this order and deleting it, I moved it three more times to a different price.

And the record of the deletion was

Good. I'll try to reproduce it.

 
Hello. You have certainly done a great and necessary work. For what you have a huge human thank you! But there is a question. The Expert Advisor that you use for tests when working on the account modifies all orders and positions regardless of the majiks and differences of currency pairs. I.e. you put it Eurobucks and at the same time another owl stands on another currency and holds there its orders and positions. you click on your advisor modification of profit or stop and it pulls not only Eurobucks, but everything that is in the terminal. It's not kosher. Thanks for understanding.
 
Sam Zabil:
Hello. You have certainly done a great and necessary work. For what you have a huge human thank you! But there is a question. The Expert Advisor that you use for tests when working on the account modifies all orders and positions regardless of the majiks and differences of currency pairs. I.e. you put it Eurobucks and at the same time another owl stands on another currency and holds there its orders and positions. you click on your advisor modification of profit or stop and it pulls not only Eurobucks, but everything that is in the terminal. It's not kosher. Thanks for understanding.

This EA is only for testing the library in the tester. It is not recommended to put it even on a demo. And it is strictly forbidden to use it on a real account.

 

Artem I replayed the situation.

The script closed all yesterday's open positions. I did not put any orders on the account, but yesterday's ones are closed. There are records of deleting orders. And not just one. There was a record "This event is already in the list" three times.

Then I placed three more positions and closed them with the script again. Everything happened again. Three positions closed ... three attempts to delete a position that is already in the history.

Even though you don't like logs, I'll put it directly from the "Experts" tab.

2019.05.28 13:07:36.530 00 EURUSD,H1: OnChartEvent: id=1002, event=TRADE_EVENT_PENDING_ORDER_REMOVED, lparam=443340764, dparam=1.11830, sparam=EURUSD
2019.05.28 13:07:36.530 00 EURUSD,H1: OnChartEvent: id=1002, event=TRADE_EVENT_PENDING_ORDER_REMOVED, lparam=443342301, dparam=1.11764, sparam=EURUSD
2019.05.28 13:07:36.530 00 EURUSD,H1: OnChartEvent: id=1002, event=TRADE_EVENT_PENDING_ORDER_REMOVED, lparam=443342388, dparam=1.11835, sparam=EURUSD
2019.05.28 13:07:36.530 00 EURUSD,H1: OnChartEvent: id=1024, event=TRADE_EVENT_POSITION_CLOSED, lparam=443663012, dparam=1.26559, sparam=GBPUSD
2019.05.28 13:07:36.530 00 EURUSD,H1: OnChartEvent: id=1024, event=TRADE_EVENT_POSITION_CLOSED, lparam=443663074, dparam=1.11876, sparam=EURUSD
2019.05.28 13:07:36.530 00 EURUSD,H1: OnChartEvent: id=1024, event=TRADE_EVENT_POSITION_CLOSED, lparam=443662954, dparam=109.36100, sparam=USDJPY
2019.05.28 13:07:36.530 00 EURUSD,H1: - Отложенный ордер удалён: 2019.05.27 14:48:42.000 -
EURUSD Удалён 0.01 Buy Limit #443340764  по цене 1.11830
2019.05.28 13:07:36.530 00 EURUSD,H1: - Отложенный ордер удалён: 2019.05.27 14:53:55.000 -
EURUSD Удалён 0.01 Sell Stop #443342301  по цене 1.11764
2019.05.28 13:07:36.530 00 EURUSD,H1: - Отложенный ордер удалён: 2019.05.27 14:54:10.000 -
EURUSD Удалён 0.01 Buy Limit #443342388  по цене 1.11835
2019.05.28 13:07:36.530 00 EURUSD,H1: - Позиция закрыта: 2019.05.28 13:07:13.000 -
GBPUSD Закрыт Buy #443663012  по цене 1.26588, профит -0.29 USD
2019.05.28 13:07:36.530 00 EURUSD,H1: - Позиция закрыта: 2019.05.28 13:07:25.000 -
EURUSD Закрыт Sell #443663074  по цене 1.11860, профит -0.16 USD
2019.05.28 13:07:36.530 00 EURUSD,H1: - Позиция закрыта: 2019.05.28 13:07:02.000 -
USDJPY Закрыт Sell #443662954  по цене 109.329, профит -0.29 USD
2019.05.28 13:07:36.500 Script CloseAllOrders EURUSD,H1: removed
2019.05.28 13:07:36.500 CloseAllOrders EURUSD,H1: uninit reason 0
2019.05.28 13:07:36.500 CloseAllOrders EURUSD,H1: Закрыт ордер 443662954 USDJPY
2019.05.28 13:07:36.500 CloseAllOrders EURUSD,H1: close #443662954  sell 0.01 USDJPY at 109.329 at price 109.361
2019.05.28 13:07:36.270 CloseAllOrders EURUSD,H1: Закрыт ордер 443663012 GBPUSD
2019.05.28 13:07:36.270 CloseAllOrders EURUSD,H1: close #443663012  buy 0.01 GBPUSD at 1.26588 at price 1.26559
2019.05.28 13:07:36.100 CloseAllOrders EURUSD,H1: Закрыт ордер 443663074 EURUSD
2019.05.28 13:07:36.100 CloseAllOrders EURUSD,H1: close #443663074  sell 0.01 EURUSD at 1.11860 at price 1.11876
2019.05.28 13:07:35.890 CloseAllOrders EURUSD,H1: initialized
2019.05.28 13:07:35.870 Script CloseAllOrders EURUSD,H1: loaded successfully
2019.05.28 13:07:24.096 00 EURUSD,H1: OnChartEvent: id=1022, event=TRADE_EVENT_POSITION_OPENED, lparam=443663074, dparam=1.11860, sparam=EURUSD
2019.05.28 13:07:24.096 00 EURUSD,H1: - Позиция открыта: 2019.05.28 13:07:25.000 -
EURUSD Открыт 0.01 Sell #443663074 [0.01 Market order Sell #443663074]  по цене 1.11860
2019.05.28 13:07:11.920 00 EURUSD,H1: OnChartEvent: id=1022, event=TRADE_EVENT_POSITION_OPENED, lparam=443663012, dparam=1.26588, sparam=GBPUSD
2019.05.28 13:07:11.920 00 EURUSD,H1: - Позиция открыта: 2019.05.28 13:07:13.000 -
GBPUSD Открыт 0.01 Buy #443663012 [0.01 Market order Buy #443663012]  по цене 1.26588
2019.05.28 13:07:01.119 00 EURUSD,H1: OnChartEvent: id=1022, event=TRADE_EVENT_POSITION_OPENED, lparam=443662954, dparam=109.32900, sparam=USDJPY
2019.05.28 13:07:01.119 00 EURUSD,H1: - Позиция открыта: 2019.05.28 13:07:02.000 -
USDJPY Открыт 0.01 Sell #443662954 [0.01 Market order Sell #443662954]  по цене 109.329
At the moment of USDJPY opening (bottom line of records) there were no open positions and pending orders.