[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 20

 
ZZZEROXXX:

Probably not quite right, or I've got it wrong, here's a drawing of what I want to achieve.

  if(ObjectFind("VerticalLine")!=-1){
    datetime TimeVL=ObjectGet( "VerticalLine", OBJPROP_TIME1); //получили координату времени где стоит вертикальная линия с именем VerticalLine  
    int shift=iBarShift(NULL, 0, TimeVL); //получил смещение линии от текущего момента в свечах 
    for(int i=0; i<=shift; i++){ // цикл от текущего бара - до бара где стоит вертикальная линия 
     double MA= iMA(NULL, 0, 12, 0, MODE_SMA, PRICE_CLOSE, i) ;
     Print("i=",i," MA=",MA);
    }
   }
   else Print("Нет Вертикальной линии");
 
kaats:

Thanks, got it, it's working!

 

Good afternoon!!!
I am a beginner, so as a blind kitten, even where to poke:))).
The problem or question is that I found an indicator, but it is stuck (i.e., to learn its performance need to get into the properties, and do not change anything to get out, then it will update).
If I wanted to update it, i would like to use some other EA.
I just have 5 identical indices with different parameters and i have to update all 5 of them every time.

i can't thank you enough!

 

People, please help, I want to keep track of orders in my EA and when a new tick comes in, if there is an open or pending order, immediately go to the beginning of the start function, to wait for a new tick, i.e. no further calculations in the EA until the number of open or pending orders is 0. Does this code meet the requirements?

 //--- Учет колличетва ордеров 
   if (OrdersTotal()>=1)
      return;
 

Question for experts, maybe someone has encountered this:

If an EA running on a weekday accidentally restarts the terminal on a weekend, then when communication with the server (trading time) comes on Monday, the EA stops working.

I tried restarting the terminal at a certain time on weekdays by jumping between timeframes, but the EA does not react as it should. It should restart, i.e. recalculate all parameters anew.

What do you advise? Maybe I am complicating things and there is a simpler way.

The answer options: "restart manually" are not suitable. Getting up at 2 a.m. and restarting the Expert Advisor on 20-30 terminals is not very interesting. If there are hundreds of accounts, do I have to spend all night pondering? In short, how to automate this at the beginning of a working week?
 
vovan-gogan:

People, please help, I want to keep track of orders in my EA and when a new tick comes in, if there is an open or pending order, immediately go to the beginning of the start function, to wait for a new tick, i.e. no further calculations in the EA until the number of open or pending orders is 0. Does this code meet the requirements?


I have not put curly brackets,

   if (OrdersTotal()>=1)
    {
      return;
    }
 
forexnew:

Question for experts, maybe someone has encountered this:

If an EA running on a weekday accidentally restarts the terminal on a weekend, then when communication with the server (trading time) comes on Monday, the EA stops working.

I tried restarting the terminal at a certain time on weekdays by jumping between timeframes, but the EA does not react as it should. It should restart, i.e. recalculate all parameters anew.

What do you advise? Maybe I am complicating things and there is a simpler way.

The answer options: "restart manually" are not suitable. Getting up at 2 a.m. and restarting the Expert Advisor on 20-30 terminals is not very interesting. If there are hundreds of accounts, do I have to spend all night pondering? In short, how to automate this at the beginning of the week?

What kind of error does it write? Does it have to write something, or does it not do anything at all?
 
LazarevDenis:


I didn't put braces,

Holy shit... Brackets are not necessary here. It'll work just as it is:

 //--- Учет колличетва ордеров 
   if (OrdersTotal()>=1)
      return;
 
forexnew:
...if an EA running on a weekday accidentally restarts the terminal on a weekend, then when communication with the server (trading time) comes on Monday, the EA stops working.
For starters, uncheck these items (sometimes they are also disabled at re-login). If it doesn't help, you need to look at the code.

 

Can write zero divide, as far as I remember. But this is due to the fact that certain parameters are not recalculated. In other words, the EA simply does not start correctly because it was started before the work session started.

Of course, these checkboxes have been removed.

I suppose any Expert Advisor launched at weekend will behave the same way. Has anyone tried it or does it work fine for everyone after a weekend start?

Reason: