And let's make a "cartoon" out of it (multicurrency) - page 3

 

Can you please tell me how I can get the opening price of orders for different Magiks in the indicator?

I've been doing this design, so far for one Magik,

int total=OrdersTotal()-1;
     OrderSelect( total, SELECT_BY_POS, MODE_TRADES);
     OP=OrderOpenPrice();
It does not work in visualization mode in the tester.
 
Angela писал(а) >>

Can you please tell me how I can get the opening price of orders for different Magiks in the indicator?

I did such a construction, so far for one Magik,

In the batter in visualisation mode it doesn't work.

Do you have open positions in your EA?

 

Questions about the code:

- Can't pass ticket for modification - Error - 'OrdTick' - variable not defined

- I need to somehow implement closing of all orders of a selected symbol

- Not sure how to trigger pending order for selected symbol


 
ALex2008 писал(а) >>

- Can't pass ticket for modification - Error - 'OrdTick' - variable not defined

- I need to somehow implement closing of all orders of one symbol

Script to close all positions for a given symbol

int start() {
   for (int i=OrdersTotal()-1; i>=0; i--){
      if (!OrderSelect( i, SELECT_BY_POS))  continue;
      if (OrderSymbol()!=Symbol())        continue;
      OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10);
   }
}
 
Vinin >> :

Script to close all positions for a given instrument

Thank you very much!

 

I've seen an example of a multi-columner in Code Base.

The code is simple and easy to understand. It's a good sample for understanding and further constructing your own design.

'Peceptron_Mult'.

 
rid >> :

Saw an example of a multi-columner in Code Base.

The code is simple and clear. It works well as a sample for understanding and further creation of your own design.

Let's see... Maybe something will come up.)

I thought my code was small...)

Nah, I'm just getting used to one code, and there's another one. I'd rather deal with one.)

 
Angela >> :

Can you please tell me how I can get the opening price of orders for different Magiks in the indicator?

I've done this design for one Magik so far,

Doesn't work in visualization mode in the batter.

maybe this one will work.

Function PriceOpenLastPos().
This function returns the open price of the last position opened. Selection of positions to be taken into account is specified by external parameters:
sy - Name of market instrument. If this parameter is set, the function will only consider positions of this instrument. The default value - "" means any market instrument. NULL value means the current instrument.
op - Trade operation, position type. Valid values: OP_BUY, OP_SELL or -1. The default value -1 means any position.
mn - Position identifier, MagicNumber. Default value -1 means any identifier.

https://forum.mql4.com/ru/11287/page24

 
Vinin >> :

Might help.

Thank you) If I understand correctly with this logical function you can in principle keep track of all the orders of the current symbol?

//-------Поиск ордеров
bool WorkOrders(){
      for (int i=OrdersTotal()-1; i>=0; i--){
      if (!OrderSelect( i, SELECT_BY_POS))  continue;
      if (OrderSymbol()!=Symbol())        continue;
      Type = OrderType();
      return(true);} 
  }
 
Vinin писал(а) >>

Are there any open positions in the EA?

Yes, the EA does open orders, but I need to pass the opening price to the indicator, taking into account the magik, to control the positions.

Reason: