ORDER_POSITION_ID - page 19

 

Problem solved, relations sorted out )

I have a related question:

It's very inconvenient to select an order by ticket to see its properties, because it doesn't matter where the order is in the history or in the market, and the ticket won't change.

So we have to search for the order both here and there.

Wouldn't it be easier to make as in MT4: if we select an order, it does not matter where it is located.

If you select an order, it does not matter where it is located:

OrderSelect

We select an order to work with it further.

boolOrderSelect(
intindex,// index or ticket of the order
intselect,// flag of the selection method
intpool=MODE_TRADES// data source for selection
);

The pool parameter is ignored if the order is selected by the ticket number. The ticket number is the unique identifier of the order.

What does anyone think about it?

P.S. I hope Michael doesn't mind continuing a branch not to multiply the number of new ones.

 

Serj_Che:

Who thinks so?

That would be... would be nice... another thing is that the developer has brought in a more complex system for dealing with different caches (positions, normal and historical orders, trades)... hence the advantages and disadvantages...

Integer, my hat is off to you and I envy your patience :-))

 
Serj_Che:

Problem solved, relations sorted out )

I have a related question:

It's very inconvenient to select an order by ticket to see its properties, because it doesn't matter where the order is in the history or in the market, and the ticket won't change.

So we have to search for the order both here and there.

Wouldn't it be easier to make as in MT4: if we select an order, it does not matter where it is located.

I have read it in MT4 Help:

What do you think about it?

P.S. I hope Mihailo does not mind to continue this thread not to produce new ones?

No, not against it at all:)

On the question of OrderSelect:

if ( OrderSelect( ticket) )
{
 //Ордер действующий(в истории его нет)
}
else
{
  //Ордер в истории
}

I don't think it's very difficult....

 
Mikalas:

No, not at all:)

On the subject of OrderSelect:

I don't think it's very difficult....

You can certainly get around it, but why the extra movement, since it's also followed by different OrderGet... and HistoryOrderGet...
 

I really do not understand why for twenty pages the topicstarter is fighting windmills and stubbornly trying to manage their robots through the control and analysis of FORTS net position, while in principle it is not possible, at least because of the presence of clearing procedures, and the transfer of net positions. Unlike FOREX, FORTS trading implies a clearing procedure. Clearing is the procedure for recalculating the liabilities of market participants, calculating their financial results for the last trading session and bringing their trades into a single net position, which will be opened after the end of the clearing session.

To understand how it happens in reality, imagine that we have two robots, each of which has made one complete trade (in terms of MT4, including entry and exit from the market):

Robot 1: Uncovered sale of 1 contract at 1000 at 28.02.2014 20:30. Exit short position at 23:30 at 700 and profit taking +300 pips (1000 - 700 = 300).

Robot 2: Buy 1 contract at 700 at 28.02.2014 23:30. Exit a long position on 01.03.2014 at 23:00 at a price of 1050 and profit taking +350 points (1050 - 700 = 350).

In terms of classic FOREX calculations it will be simple. Initially, there will be one sell position in volume 1 from 28.02.2014 20:30 to 28.02.2014 23:30. This position will belong to robot 1. He will then close it at 23:30. At the same moment robot #2 will open an opposite buy position of volume 1. It will exist from 28.02.2014 23:30 to 01.03.2014 23:00, until Robot #2 closes the sell order. Visually, these positions are indicated by the orange dotted lines on the chart below. As each triggered order has the identifier of the position to which it belonged and the identifier of the Expert Advisor, we can compare the orders which were placed by the Expert Advisors with net positions and conclude that the positions belong to the corresponding Expert Advisors. But in FORTS the positions are matched from executed trades and transferred through clearing. It will be more understandable to show it on a conditional chart:

Instead of calculating the result of your aggregate positions by the time of the first clearing, your broker will calculate the result of individual trades (trades). It will calculate as follows:

Daily clearing price 01.03.2014: 950

Sell price in volume 1: 1000; the result of the trade: 1000 - 950 = 50 pips.

Buy trade price in volume 1: 700; Trade result: 950 - 700 = 250 pips.

Transaction price Buy in volume 1: 700; transaction result 950 - 700 = 250 pips.

Total trade result: 50 + 250 + 250 = 550 p ips.

The result in pips will be converted into financial result in RUR and credited to your account (in case of daily clearing, only the estimated calculation will be done and it will be added to the column "earned profit").

Interestingly, in a classic calculation, the total result at the time of clearing will be similar:

Sold 1 contract at 1000 closed the sale at 700. Result = 100 - 700 = 300 points.

Buy 1 contract at 700 and close the buy at clearing 950. Result = 950 - 700 = 250 pips.

Total of the two positions = 300 + 250 = 550 p ips.

At the time of clearing a new net position will be generated from your trades, with a new identifier and new parameters. This net position will be available for your work starting from the market opening after clearing. This net position will last until the next clearing. Then it will be liquidated and a similar position will be created in its place, but with a different identifier. Before it is liquidated, the variation margin accrued on that position will be credited to your account. However, the total result of all net positions initiated by clearing and all completed trades will be exactly equal to the result obtained in the classic, FOREX calculation of positions.

Sooner or later, the second robot will make a sell deal to close with the opposite volume its buy. This deal will belong to some net position, but it will be a completely different position and not the one the buy order belonged to. Since the positions are different, with different identifiers, through these positions we will not be able to connect two EA orders (opening and closing) and thus obtain the classical positions, such as those marked with orange dotted lines in the figure above.

The topicstarter is stubbornly trying to work with net FORTS positions (black lines in the picture) like it is done in FOREX (orange dashed lines in the picture). However, visually it is clear that they are very different positions, and their calculation is very different.

In reality, the picture is even more complex, because there are conversion rates, dozens of transactions with different execution prices belonging to the same order, the charging of commissions on scalper deals and net positions and other realities of working on FORTS.

 

C-4, you are mistaken, re-read the position reference.

 
Too bad I closed my account with my broker. Does anyone have a trading history that will clearly show how the clearing is going?
 
barabashkakvn:
Too bad I closed my account with my broker. Maybe someone has a trading history to clearly see how the clearing is going?
Open a demo account at BCS or Otkritie.
 
Mikalas:
Open a demo account at BCS or Otkritie.
I've experienced a broker demo account before. It's complete rubbish. It's not a combat environment. Eternal flaws. Only real. And there are no such animals in my area ("BCS or Otkritie") :)
 
barabashkakvn:
I have experienced the broker's demo account before. It's complete rubbish. It's not a combat environment. It's always underperforming. Only real. And there are no such animals in my area ("BCS or Otkritie") :)
You have the Internet, right? On the Internet they do :)
Reason: