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

 
tara:
There are all sorts of things. For example, if position management needs to be transferred to another advisor.
Well, if the other advisor is also his own, then you can feed him with any additional magician.
 
tara:
There are all sorts of things. For example, if position management needs to be transferred to another EA.
I divide an EA into two parts: analytical and trading. The analytical part is unique to each EA, but the administrative part is the same for all of them (perhaps not all of the administrative functions are involved in each EA). And I do not need to transfer orders between EAs.
 

Rummaged through the help and searched the site, but couldn't find any examples of how to use the MessageBox function. Please advise:

1. Is it possible to change the location of the window displayed by MessageBox?

2. Can I change the names of the buttons, e.g. from "Ok" and "Cancel" to "aha" and "no way"?

3. what do MB_DEFBUTTON flags do in this function - which buttons are we talking about and what is it for?

 

Good day (or night).

Please advise, if I loop the code (for or while, whatever), and put in the loop the code of getting the value of one of indicators (or the price in a variable), will it work?

Will the variable, which is in the loop, receive its values at a new tick, because the procedure is looped?

 
culler:

Good day (or night).

Please advise, if I loop the code (for or while, whatever), and put in the loop the code of getting the value of one of indicators (or the price in a variable), will it work?

Will the variable situated in the loop always receive a value at a new tick, because the procedure is looped?

In such a loop, before e.g. getting the Ask price (or something else that comes with the tick), put RefreshRates() before this action to request the current Ask value, not the old Ask value that came with the tick that started the loop. If you request the indicator value inside the loop, the current value should be correct.

To be 100% sure, make a simple Expert Advisor with your loop and display the information on the chart through Comment(), and you will see immediately if the values are correct in the loop.
 
paladin80:

In such a loop, before getting, for example, Ask price (or something else that comes with the tick), put RefreshRates() before this action to request the current Ask value, not the old Ask value that came with the tick that started the loop. If inside the loop you request the value of the indicator, the correct current value should be obtained.

To be 100% sure, make a simple Expert Advisor with the loop and display the information on the chart through Comment() and you will see immediately if the values obtained in the loop are correct.


Thank you.
So, it will work. This is good.

By the way, is it correct to use this approach in a loop, or is it perverse?

I noticed that because of such a cycle MT4 hangs completely.

 
culler:


By the way, is this the right approach to the cycle or is it a bit perverse?

I've noticed that because of this cycle, MT4 hangs up completely.


And there are lovers of perversion. I mean looping.
 
Hi all. Can you tell me how to test an EA at 0 spread. Maybe something needs to be prescribed in the code.
 
culler:


Thank you.
So it will work. That's great.

By the way, is this approach to the cycle correct or is it a bit perverse?

I've noticed that the loop causes MT4 to freeze up completely.


From the help"Each script and each expert works in its own separate thread. "

"A looped script or Expert Advisor cannot disrupt work of other programs".

i.e. looping can be used.

I am using a script and such a template for these tasks:

void OnStart()
  {
   while(!IsStopped()) // пока скрипт не удалён с графика
     {
      bool is_new_tick=RefreshRates();
      // если true значит пришли новые котировки
      if(is_new_tick)
        {
         // код который необходимо выполнять при новых котировках
        }
      //остальной код
      Sleep(100);
     }
  }
 
culler:


I have noticed that MT4 hangs completely because of the loop.
So it will work. This is great.

By the way, is this approach to the cycle correct or is it a bit perverse?

I've noticed that this cycle causes MT4 to freeze up.

Doing something through such a loop is a bit of a perversion after all. For which task do you need an infinite loop? I think many tasks can be done differently, through OnTick() or OnTimer().