Questions from Beginners MQL5 MT5 MetaTrader 5 - page 946

 
Nauris Zukas:

OK, let me ask the question differently. For example, I can write all data in the file (FileWrite), then I can do everything with the indicator and compile and even the terminal is closed, but I can always then refer to the file for data (FileReadString), they will be there. Question, is it possible to write all the data not in a file, but in memory of computer (or terminal), as in an array? The array is not suitable, because it is reset when you compile the indicator. The data must be saved while the terminal is open.

Resources.

 
fxsaber:

Resources.

Thanks, I'll probably start there.

 

I am opening a position in the tester. 10 trades of 0.1 lot each.

So after that I request orders and among other things I get a position identifier according to the order ticket:

long pos_id=HistoryOrderGetInteger(order_ticket,ORDER_POSITION_ID);

10 trades, each corresponding to a different order. However, I can only get an identifier for the first two orders which correspond to the first two trades. The identifier for the subsequent orders is 0.

What is this mystery?

Deal - Order

2 - 2

3 - 5

4 - 8

5 - 11

...

11 - 29


After each open trade I put two more limiters as stops. Therefore, the tickers of deals and orders are different. So, I can get a non-zero position identifier only for orders with tickets 2 and 5. Yes, this position has already been closed. There is no current open position.

 
Juer:

I have a position open in the tester. 10 trades of 0.1 lot.

***

How do you open ONE position in TEN trades?

How do you get TEN trades by sending ONE trade order?


Or describe the situation more precisely (trading account type, instrument name, direction of each trade)

 
Vladimir Karputov:

How do you manage to open ONE position with TEN trades?

How do you manage to open ONE trade order and get TEN trades?


Or describe the situation more precisely (trading account type, instrument name, the direction of each trade)

Well probably I open a position with one trade. But other trades like IN in the same direction belong to the same position.

Where did I write that I sent one trade order?

10 trades in the same direction (buy in this case). 10 orders. But when requesting the order history only the first two have a Position identifier. The rest have 0.

 
Juer:

Well I guess I open a position with one trade. But other trades like IN in the same direction belong to the same position.

Where did I write that I sent one trade order?

10 trades in one direction (buy in this case). 10 orders. But when requesting the order history only the first two have a Position identifier. The rest have 0.

Please answer more precisely:Or describe the situation more precisely (trading account type, instrument name, direction of each trade)

 
Vladimir Karputov:

Please answer more precisely:Or describe the situation more precisely (type of trading account, instrument name, direction of each trade)

BICMarkets-Demo server, EURUSD. Buy trades, 10 trades. And then 10 trades Sell (out). And after that I'm trying to get the position ID from the order number (see above).

What is the account type? What is it? Hedging or not? I don't even know.

 
Juer:

BICMarkets-Demo server, EURUSD. Buy trades, 10 trades. And then 10 Sell (out) trades. And after that I try to get the position ID from the order number (see above).

Type of account? What is it? Hedging or not? I don't even know.

Account type: netting or hedge. There is no third :) . Oh, now there are 20 trades already. At the beginning it was 10. If you want a good answer to this question, ask it properly.

List trades step by step. Provide a log of the terminal - so that we can compare it with what you say and what you mean.

 

I'm looking through standard classes and I often see unnecessary brackets, as it seems to me.

//+------------------------------------------------------------------+
//| Get the property value "POSITION_TYPE"                           |
//+------------------------------------------------------------------+
ENUM_POSITION_TYPE CPositionInfo::PositionType(void) const
  {
   return((ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE));
  }

What are brackets at the beginning and at the end for here?

What are they for here?

//--- return the result
   return( str);
 
pivomoe:

I'm looking through standard classes and I often see unnecessary, as it seems to me, brackets.

What are brackets at the beginning and at the end for here?

Why do they need it here?

For readability