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

 
Guys, off-topic question, I'm a newbie, I would like to order a job, now I have 0 on my balance, can I open a theme? or do I have to top up my account first? a little confused when they block money from my account...
 
OBERON1812:
Guys, off-topic question, I am a newbie, I would like to order a job, I have 0 on my balance, can I open a theme? or do I have to top up my account at the beginning? a little confused when they block money from my account...
You have to top up your account for the required amount first, otherwise there will be a problem in the middle of making a request. Maybe you should make a request first, then choose a performer and top up your account with the required amount.
 

Vitaly Muzichenko:


Reverse overshoot on closed

Thank you ... I am interested in the reverse lookup on open orders ... would that work correctly?
 for(int i=OrdersTotal()-1; i>=0; i--) {
  if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
 
Yaroslav Nykula:
Thank you ... I'm interested in going over open orders ... Will this work correctly?
Yes, you can check it via Print();
 
Vitaly Muzichenko:
Yes, you can check through Print();
 for(int i=OrdersTotal()-1; i>=0; i--) {
  if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
Thanks ... Everything is basically clear to me, buti=OrdersTotal()-1; why-1, and noti=OrdersTotal();... In this case, it turns out that the last of opened orders will be excluded from recalculation - or am I mistaken?








 
Yaroslav Nykula:
Thanks ... I understand everything, but I am confused byi=OrdersTotal()-1; why-1 and not justi=OrdersTotal();...In this case, it turns out that the last of the open orders will be excluded from the recalculation - or am I wrong?









OrderTotal() shows as many orders as there are, and order counting starts from zero. In other words, we need minus one to be correct in this case.
 
Yaroslav Nykula:
Thanks ... I understand everything, but I am confused byi=OrdersTotal()-1; why-1 and not justi=OrdersTotal();...In this case, it turns out that the last of the open orders will be excluded from the recalculation - or am I wrong?
Print(), and you won't have such questions, it's not difficult
 

To anyone reading this, hello.

The question is as follows, how to set a spread or ASK price in the MT4 tester with historical Ask price data.
Let me explain.
In the MT4 terminal we have a history of some Symbol (in it all prices are Bid respectively) and we have the Symbol_ask history (all ask prices, this history is also provided by a broker)

Is it possible to use this data in the tester?

 
Yaroslav Nykula:
Thanks ... I understand everything, but I'm confused byi=OrdersTotal()-1; why-1, and not justi=OrdersTotal();... In this case, it turns out that the last of opened orders will be excluded from recalculation - or am I mistaken?

This is because it is counted from 0. If you have 10 orders, then count ordinal numbers should be 0...9, that is, 0...(10-1), whereOrdersTotal()=10.

Just keep this in mind when writing programs.

 
Yaroslav Nykula:
Thanks ... I understand everything, buti=OrdersTotal()-1; why-1 and noti=OrdersTotal();...In this case, it turns out that the last of the open orders will be excluded from the recalculation - or am I wrong?
Number1
2
3
4
5
6
7
8
9
10
Index0
1
2
3
4
5
6
7
8
9

As you can see - there are ten orders, but their indexes are 1 less, because in any array the count starts from zero.

OrdersTotal() is 10, but if you start a loop with OrdersTotal(), then you will go outside the array - the index of order 10 is not there - the largest index is 9 - so OrdersTotal()-1

Reason: