Transition of positions after 0:00 when the bank is operating. How to identify? Need help from the hall. - page 7

 
Oldman_Evgeny:

Well, nobody poked me anywhere.

I had to invent it myself.

So.

At 23:50, if my Expert Advisor works by open or close, I switch to processing of each tick.

If the expert works by ticks, I do not need to go anywhere.)

At the first tick after 23:50, I forcibly close the position.

(I tried to close not at 23:50, but later, but ran into a situation when I set the closing for 23:56, and from 23:56 to 00:00 has not come a single tick.

The rollover kicked in and it all went to shit!..! (Just in case, I took 23:50 with reserve - for sure in 10 minutes at least one tick would come!)

I remember all parameters of a position - was it a buy or sell position, stoploss, takeprofit, etc.....

Until 00:00:00 I prohibit opening of positions.

After 00:00, at the first passing tick I forcefully open a position in the same direction as it was, with all attributes of a position closed at 23:00.

Thus I bypass the rollover.

As a rule I'm losing more than on rollover, but at least I have a normal position continuation.

I couldn't think of another one....

The only problem on Friday is that the market opens at 01:00 on Monday.

But I decided not to open position at Monday night, because different "cataclysms" often happen - gaps, reversals and other stuff.

I simply close my position on Friday and that is all. I do the same on holidays.


PS. I think the lack of position data transfer with rollover is cheating. I will deal with it through the AFD. If anything, we can complain to the Central Bank.

They do not take much pity on forex dealers there.

Isn't the position ID (not the ticket) saved during rollovers?
 
Only the direction and lot size are saved. There is nothing else.
 
Oldman_Evgeny:
Only the direction and lot size are saved. Nothing else.
PositionGetInteger(POSITION_IDENTIFIER)

what does it return?

 

PositionGetInteger(POSITION_IDENTIFIER), as it should, returns the ticket number.

The new number of the ticket, which is the result of rollover, not the position that was before rollover....

But after rollover, in the new position, it turns out that m_position.Magic()=0. Accordingly, nothing works in the Expert Advisor....

Probably, one can somehow cram Magic via modification into new position and there cram everything else from old position.

But I did as I wrote above. But I'll think about it some more.

It's annoying that PSB cheats like this with their platform.

And, as far as I understand, they're not the only ones...

Surprised by the traders' silence! Does everyone only trade intraday or pips?

Well, don't go trading in some kitchen like alparey when there are licensed russian brokers....
 

Tried inserting a construct in OnTick

if(m_position.Magic() == 0) m_trade.SetExpertMagicNumber( EA_Magic );

The construct does not work.

It looks like there is no way to change Magic on an open position....

So, what I did and described above seems to be the only option.

 
Oldman_Evgeny:

Tried inserting a construct in OnTick

if(m_position.Magic() == 0) m_trade.SetExpertMagicNumber( EA_Magic );

The construct does not work.

It looks like there is no way to change Magic on an open position....

So, what I did and described above seems to be the only option.

What are you all carrying around with the magician? Wrap each position in a class and on the tick do not look for it, just track it. If it suddenly closed, then analyze the reason for closing. If the reason is rollover, then look for a new one and change the class fields to the actual ones. To organize restart after failures we write all necessary information in a separate file (well I don't like global variables of terminal).
 
Vladimir Simakov:
To organise a restart after failures, we write all the necessary information in a separate file (well, I don't like global variables of the terminal).

And if the Expert Advisor is running on different machines, do we have to carry the file with us?

 
Ihor Herasko:

And if the Expert Advisor is running on different machines, do you have to carry the file with you?

Ftp, cloud are options.
If just data is to be exchanged between robots, then pipe and ws.
 
Vladimir Simakov:
Ftp, cloud - as an option.
If just data has to be exchanged between robots, then pipe and ws.

Why go to all that trouble when you have Magic? In most cases it's good enough. At least I have managed to use it:

  1. Time of occurrence of the signal, at which the order/position is opened
  2. The index of the grid (if a strategy is a grid) to which the order belongs
  3. The index of the order in the grid
  4. The Expert Advisor ID itself
All this has certain limitations, of course. However, the limitations are quite reasonable. Going beyond them is a rare occurrence.

 
Ihor Herasko:

Why go to all that trouble when you have Magic? In most cases, it's good enough for the eye. At least I was able to use it:

  1. Time of occurrence of the signal, at which the order/position is opened
  2. The index of the grid (if a strategy is a grid) to which the order belongs
  3. The index of the order in the grid
  4. The Expert Advisor ID itself
All this has certain limitations, of course. However, the limitations are quite reasonable. Exceeding them is a rare occurrence.

So you yourself have answered - with limitations, which is exactly what this thread is discussing. Pros of the wrap:

  1. The time of occurrence of the signal is the same.
  2. The grid index is the same.
  3. Index of an order in the grid - so, again, it is an explicit index.
  4. Expert Advisor identifier - well, you got it.

The whole joy of this is that during the check, the market position state is checked and the fields of the class are corrected. At the same time, we do not go through the positions; the trade function handler is a method of the class. No one forbids using magik for recovering from failures - simply, we can easily pack the entire history in a binary, just develop a format.

As for the work of robots with shared orders on different workplaces - what is the point? I can't think of anything else except the synchronization problems. Just think: a robot gives a command to close a position on one workplace, while on the other one it makes a trading decision based on the fact that this specific position is opened, how can we synchronize it?