List of benefits in the market where you put the EA

 

Hello friends ... I am a novice programmer ... Now after a year I can take on more complex things ... I'm working hard to learn more ... now I'm stuck on something that is not too complicated ... but not out of here ... EA need to have in a list of results (profit) from last 30 operations already carried out ... that's easy ... but having multiple markets because optengo not in order and that I get is a list of the last 30 but ... operations or other markets or to "0" in those spaces ... depending on the market place the EA get the list of the last 30 operations in that market ... I'm not stuck ... thanks

 
chema:

Hello friends ... I am a novice programmer ... Now after a year I can take on more complex things ... I'm working hard to learn more ... now I'm stuck on something that is not too complicated ... but not out of here ... EA need to have in a list of results (profit) from last 30 operations already carried out ... that's easy ... but having multiple markets because optengo not in order and that I get is a list of the last 30 but ... operations or other markets or to "0" in those spaces ... depending on the market place the EA get the list of the last 30 operations in that market ... I'm not stuck ... thanks

Everything you need is in the Order History,  you need to chose the information from there that you need,  not the information you don't need.
 

chema:

I'm trying of two ways ... the gray one I have that does not work 

Please edit your post . . . 


Please use this to post code . . . it makes it easier to read.

 

The order positions start from 0 not from 1  so the last position is Total -1 not Total.

 

chema:

 Now I get all zeros 


You can't do this . . .

if(Total > 0 && OrderSymbol()==Symbol())

 . . .  you haven't selected an Order. 

Please read the Documentation . . .    "Note: The order must be previously selected by the OrderSelect() function."

What is OrderType 1 ?

 
Please edit your post . . .   or I will remove your code.
 

RaptorUK:
Please edit your post . . .   or I will remove your code.

 

so better? 

 

chema:

so better?  

You could have simply edited your post and put your code in a SRC box . . . . so it looked like this . . .  

 

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {

int Total = OrdersHistoryTotal();      Alert("Total= ",Total);


//   double profit29=0;double profit28=0;double profit27=0;double profit26=0;double profit25=0;double profit24=0;double profit23=0;
     double profit22=0;double profit21=0;double profit20=0;
//   double profit19=0;double profit18=0;double profit17=0;double profit16=0;double profit15=0;double profit14=0;double profit13=0;
     double profit12=0;double profit11=0;double profit10=0;
//   double profit09=0;double profit08=0;double profit07=0;double profit06=0;double profit05=0;double profit04=0;double profit03=0;
     double profit02=0;double profit01=0;double profit00=0;

if(Total > 0 && OrderSymbol()==Symbol())
   {
   for(int ord = Total; ord >= 1; ord--)
 
RaptorUK:

Usted podría simplemente haber editado tu post y poner su código en una caja de SRC. . . . por lo que se veía así. . .  

 ah ... sorry

 
chema:

do not know how you do that

now I get the sum of a market 

Files:
optimaf1.mq4  9 kb
 
RaptorUK:

The order positions start from 0 not from 1  so the last position is Total -1 not Total.

Read this,  it will help:  Loops and Closing or Deleting Orders
Reason: