Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1600

 
Nerd Trader:
Saw now that you've added a log. Here you have duplicate messages too :)
If you look at the time, you will see that nothing is duplicated, it only prints on a new bar when there is a signal
 
законопослушный гражданин:

can you please explain the difference between the functions?

for (int j = OrdersHistoryTotal()-1; j >= 0; j--)

{

if(OrderSelect(j, SELECT_BY_POS,MODE_HISTORY))

и

int i=OrdersHistoryTotal();

for(int pos=0; pos<i; pos++)

{

if(OrderSelect(pos, SELECT_BY_POS,MODE_HISTORY))

No

 
MakarFX:
If you look at the time, you will see that nothing is duplicated, it only prints on a new bar when there is a signal
Because you have Print() only in OnTick(). Put it in each condition in isCrossing()
 
MakarFX:

No

Well, not exactly. One cycle from the beginning of the list, the other from the end.

 
MakarFX:

No

both functions "fetch" closed orders from the history ?

 
Artyom Trishkin:

Well, not exactly. One cycle from the beginning of the list, the other from the end.

You're right, I didn't pay attention to the order of the loop, I only looked at the definition of OrdersHistoryTotal()
 
законопослушный гражданин:

both functions "fetch" closed orders from the history ?

Yes, but one from the beginning of the history and the other from the end.
 
MakarFX:
Yes, but one is from the beginning of the story and the other from the end.

Thank you. Did I get it right, this function "goes through" from the end?

int i=OrdersHistoryTotal();

for(int pos=0; pos<i; pos++)

{

if(OrderSelect(pos, SELECT_BY_POS, MODE_HISTORY))

 
законопослушный гражданин:

Thank you. Did I get it right, this function "goes through" from the end?

int i=OrdersHistoryTotal();

for(int pos=0; pos<i; pos++)

{

if(OrderSelect(pos, SELECT_BY_POS, MODE_HISTORY))

yes
 
законопослушный гражданин:

Thank you. Did I get it right, this function "goes through" from the end?

int i=OrdersHistoryTotal();

for(int pos=0; pos<i; pos++)

{

if(OrderSelect(pos, SELECT_BY_POS, MODE_HISTORY))

This one searches from the zero index, i.e. from the beginning.

Reason: