Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 57

 
FAQ:

What about arrays?

We read the list of orders into a two-dimensional array, the first dimension is a magik, the second is a profit.

ArraySort() - the orders are lined up by magicians in the order, then we start summing them up and displaying.

This is cool!

What do we have at the intersection of dimensions?

 

If we directly read orders from the list, the magicians will be scattered, i.e. at least we need to know the magicians, or to make a loop inside the loop to find a magician in the second list and add a profit to it.

After ArraySort() the magicians are lined up in order. we simply go through the array and sum up the second dimension (profit) as soon as a magician in the first dimension has changed - we output a text variable :

int premagic = arr[0][0];
string text = "";
for(i=0;i=ArrayRange(arr,0);i++){
   if(arr[i][0]==premagic){
       profit += arr[i][1];
   }else{
       text = text + "MagickNum :"+premagic+"  Profit :"+profit+"\n";
       profit   = arr[i][1];
       premagic = arr[i][0];
   }
}
Comment(text);
 
borilunad:
Check exactly the weekly history of W1!

Thanks, only I download the history when installing and check specifically on the period where there are definitely no holes - the candlesticks are on the chart.
 
Help for a newbie! I cannot solve one problem.
An Expert Advisor opens up to 100 orders, puts sl and thr. When a certain signal level is crossed the order is modified sl. and thr. Each order has its own individual signal level, sl and thr. Sl and thr for further modification is calculated at the moment the order is opened.
I can't think of an algorithm. Please give me a push!!!
 
How can I make my EA remember that no more than two orders can be opened on a particular candlestick?
 
MauzerVII:
How to make the EA remember that no more than two orders may be opened on a certain candlestick?


If from the market, remember the time of opening an order and set the number of open orders to one.

When the next order is opened, check the time, if it has not gone beyond the bar, then increment the number of open orders.

The rest of the logic is quite easy to build.

 

another question :

We close a batch of orders, about 30 orders per cycle

How to check if all orders are closed or to make a loop that will pound the broker until it stops requotes?

I just sketched the first thing that came to mind, is it possible to do this ?

void close (int m)
{
for( int f=OrdersTotal()-1; f>=0; f--)
if ( OrderSelect(f,SELECT_BY_POS)    )
if ( OrderSymbol()==Symbol()         )
if ( OrderMagicNumber()==m           )
if (OrderType()==0)
if (OrderClose(OrderTicket(),OrderLots(),Bid,Slip,Red)==true) continue;
else f++;
if (OrderType()==1)
if (OrderClose(OrderTicket(),OrderLots(),Ask,Slip,Red)==true) continue;
else f++;
}
 
nachalo = H;
finich = D;

if (DayOfWeek() == 1 && Hour()==H && Minute()<=00)
      {
      Opn_B = true;
      }
if(DayOfWeek() == 2 && Hour()==D && Minute()<=01)
      {                                           
      Cls_B=true;                 
      }

When testing the EA by days of the week and hours, wrote the following code:

Variables "H", "D" output to:

extern int  H = 18;  
extern int  D =19;
in EA properties I set variable start values from 0 to 23, step 1.
All results are rejected as insignificant. Other EAs have set testing range but this one does not work.
Please, tell me what is wrong?
 
nachalo = H;
finich = D;

if (DayOfWeek() == 1 && Hour()==H && Minute()<=0)
      {
      Opn_B = true;
      }
if(DayOfWeek() == 2 && Hour()==D && Minute()<=1)
      {                                           
      Cls_B=true;                 
      }
 
VOLDEMAR:


Thank you, it took me three days to manually calculate it.

The only annoying thing is that the percentage of profitable trades is not visible in the optimization, or is there any way to display it?