[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 340

 
granit77:
Yes, if you have ticked the "Skip useless results" box. Optimisation Results tab, right mouse button.
Thank you!
 
silhouette:

What should be the size of the arrays - I don't know. Its index should accumulate over the whole interval of calculated bars, i.e. starting from the bar limit.

I will try to describe the logic of the problem in words.

  • We have three indicator buffers that draw a colored LSMA. If its value on the current bar is higher than the previous one, we leave the value in yellow and green buffers and clear the value in red. If the current value is lower than the previous one - on the contrary. In all other cases - we clear the value in the red and green buffers, leaving only the yellow one.
  • Green series buffer value is 1, index value is 0. If green buffer on the current bar =EMPTY_VALUE and on the previous one too =EMPTY_VALUE, then green buffer's value increases by one (value accumulation). If value of green buffer == EMPTY_VALUE, while value of red buffer == EMPTY_VALUE too (only yellow colour on the chart), it means that the series is over - we assign series length to green series array with index 0 (we save it to the buffer). We increase the array index by one (the next ones will now be 1, 2, 3 etc.), reset the series value to one, wait for the beginning of the next green series.
  • Similar manipulations are performed with the red series array.

As long as the purpose of filling these arrays is not clear, no algorithm is born. It is not clear for what further purposes these arrays will be used. Hence there is no algorithm that is suitable for saving them. After all, they will be constantly overwritten with new data. You are talking about the length of the series. The green series will end as soon as the yellow or red series starts. Similarly, the red series will end as soon as the yellow or green series starts. In other words, only one series that is currently in effect and the series that precedes it will be up-to-date. Or there should be several such series, alternating between them.

In short - in peasant-labor terms: why do we need these arrays of series? How will it be represented graphically in the turkey, or what for?

 

HELLO!!!

Who would help to write an EA with functions

1 open time H and M

2 loss volume (lot) multiplier

3 lot volume

4 stop loss

5 take profit

only for Buy position

It seems to be simple but it does not work

 
artmedia70:

As long as the purpose of filling these arrays is not clear, no algorithm can be created. It is not clear for what further purposes these arrays will be used. Hence there is no algorithm for saving them. After all, they will be constantly overwritten with new data. You are talking about the length of the series. The green series will end as soon as the yellow or red series starts. Similarly, the red series will end as soon as the yellow or green series starts. In other words, only one series that is currently in effect and the series that precedes it will be up-to-date. Or there should be several such series, alternating between them.

In short - in peasant-labor terms: why do we need these arrays of series? How will it be represented graphically in the turkey, or what for?

The code shows that there is a different array for each type of series (green or red).

Purpose: to collect statistical information for further analysis, both using MQL tools and Excel.

Simply put, the array should look something like this

RedSeries[0]=10; RedSeries[1]=11; RedSeries[2]=4 ...

GreenSeries[0]=6; GreenSeries[1]=8; GreenSeries[2]=10 ...

If it matters, the dynamics of colour change is as follows: green cannot change into red, nor can red change into green. That is, there is always yellow in between.

 

Please explain, if an order is found to close and needs to be closed, is there a need to list the parameters after the ticket?

Example: OrderClose(OrderTicket(),OrderLots(),Bid,30,Blue);

replace with OrderClose(OrderTicket(),NULL,NULL,NULL);

or to OrderClose(OrderTicket(),EMPTY,EMPTY,EMPTY);

Is it possible to write it even shorter to close, considering only the ticket?

 
rosomah:

Please explain, if an order is found to close and needs to be closed, is there a need to list the parameters after the ticket?

Example: OrderClose(OrderTicket(),OrderLots(),Bid,30,Blue);

replace with OrderClose(OrderTicket(),NULL,NULL,NULL);

or to OrderClose(OrderTicket(),EMPTY,EMPTY,EMPTY);

Is it possible to write it even shorter to close, considering only the ticket?


No. There is a concept of partial order closure. Therefore the parameters must be specified explicitly. Try to open an order with lot=1.5 on the demo, and then close that order with lot=1. You will see that if the order went into profit, you can close not the whole order, but only a part of the lots, allowing the remaining lots to continue going into profit.
 
silhouette:

The code shows that there is a different array for each type of series (green or red).

Purpose: to collect statistical information for further analysis, both using MQL tools and Excel.

Simply put, the array should look something like this

RedSeries[0]=10; RedSeries[1]=11; RedSeries[2]=4 ...

GreenSeries[0]=6; GreenSeries[1]=8; GreenSeries[2]=10 ...

If it matters, the dynamics of colour change is as follows: green cannot change into red, nor can red change into green. That is, there is always yellow in between.

So set up two two-dimensional arrays. One for the Green data and one for the Red data. In one dimension write the time, in the other the numeric value. As soon as the green data appears, increase the green array by 1 and write in the time and the zero bar value. Do the same for the red array. Then, after the data is accumulated in the arrays, you can process them as needed. Or write all data to the file from the Expert Advisor at once.
 

Hi all.

How do I recognise orders opened by an EA from the same orders with an empty magik opened manually?

 
swird:

Hi all.

How do I recognize an order opened by an EA from a manually opened order with an empty magic?

In the order loop we should check the OrderMagicNumber operator like this:

if (OrdersTotal()>0)
{  for (int i=OrdersTotal()-1; i>=0; i--)
   {  if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {  if (OrderMagicNumber()==MagNum) // тут
         {  //--- некоторое действие.

}  }  }  }
 
artmedia70:
So set up two two-dimensional arrays. One for the Green data and one for the Red data. In one dimension write the time, in the other the numeric value. As soon as the green data appears, increase the green array by 1 and write in the time and the value of the zero bar. Do the same for the red array. Then, after the data is accumulated in the arrays, you can process them as needed. Or write all data to the file from the Expert Advisor at once.

Thank you.

But I can't understand the point of creating a time measurement. After all, there are several bars in a series and their times are different. In this way, it is not possible to record the series.

And another thing: I can't understand where there is a logical error in my code. What is the reason why it doesn't work? Without it, any attempt to redo anything is useless.

Reason: