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

 

The following effect is encountered in the course of the EA's work.

I open an order in the market. There is always only one order in the market. If the profit goes to profit, the SL should be trawled.

But in some cases the SL is not trailed on the current candle. But as soon as a new candle opens, everything starts working perfectly (SL is rejected).

Note, this does not happen regularly. The feeling is that the OrdersTotal() remains null on the current candlestick, so it does not perform any action during the search.

If there were an error in the code, it would occur in each such case. But here this effect occurs irregularly.

What could be the reason for this behavior?


The effect was encountered in the Strategy Tester and also appeared on a demo account.

The code is standard. Builds: MetaEditor (version 5.00) - 934, MetaTrader (version 4.00) - 646.

   for(i= OrdersTotal()-1; i >=0; i--) 
     {
      if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
       {
        if(OrderSymbol()==Symbol() && (Магик < 0 || OrderMagicNumber()==Магик))
         {
          Трал();
         }
       }
     }
 
Desead:

look not into the future but into the past, do a hole check and that's it.


How do you open a position at 03:00 when the terminal is at 04:00?
 
AlexeyVik:

There are instructions on the ista forum. The author, if I remember correctly, is Onna.

Yes it is. I have it saved in my bookmarks , only it's not insta, it's robo.

I don't know how it will be now with the new MT though, the format has changed.
Thanks, almost exactly what I wanted! Unfortunately AllMinutes_Step1 didn't "fill in" the holes with previous quotes, as I expected from it.
 
001:
Thanks, almost exactly what I wanted! Unfortunately AllMinutes_Step1 didn't "fill in" the holes, with previous quotes, as I expected it to do.

I didn't try to do everything described there, just took ready base at the end and ran the Expert Advisor. I don't use the tester at all, I only use it to detect errors in code. But considering the changes in the history format I think we should rewrite the scripts that are there taking these changes into account.
 
AlexeyVik:
I didn't try to do everything described there, I just took a ready base at the end and ran the EA. I don't use the tester at all, I only use it to detect errors in the code. But considering the changes in the history format, I think we should rewrite the scripts that are there taking these changes into account.


Looks like we'll have to rewrite it. Or use old terminal + firewall.
 
001:

Looks like we'll have to rewrite it. Or use the old terminal + firewall.
Firewall won't help. You have to delete the update files. Search the forum for the path to them.
 
AlexeyVik:
Fire won't help. You have to delete the update files. Search the forum for the path to them.


I meant terminal ONLY for testing, i.e. not logged in + firewall. Because even when I'm not logged in, it'll update on its own.
 
001:

I meant terminal ONLY for testing, i.e. not logged in + firewall. Because even when I'm not logged in, it updates itself.

To avoid the update and need to remove the update files. MT does not download them every time you need to update, they are downloaded and updated only once.
 

Folks, could you please tell me how to convert double to int?

MatRound and other rounding functions return, oddly enough, Double. And if int variable is assigned to MatRound function, the compiler generates a lot of warnings like

possible loss of data due to type conversion
 
tuner:

Folks, could you please tell me how to convert double to int?

MatRound and other rounding functions return, oddly enough, Double. And if int variable is assigned to MatRound function, the compiler generates a lot of warnings like

double d = 123.456;
int i = int(d);