[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 363

 
_Aybulat_:
Do I understand it correctly. A static variable does not lose its value between calls to start()?

yes. see here.
 
markeliano:

Why can it remove itself?


it is a script, located in the folder for scripts, it is executed once and deleted. move it to the folder for EAs and it will not be deleted
 

And why is it when you try to test only on H1, and less than that, only a black screen with the inscription waiting for update?

And how to test if I set a year, but it really takes about a month on H1, and manages to put only 6 positions, and then does not come to the end, whatever dates do not set?

 
Dimka-novitsek:

And why is it when you try to test only on H1, and less than that, only a black screen with the inscription waiting for update?

And how to test if I set a year, but it really takes about a month on H1, and manages to put only 6 positions, and then does not come to the end, whatever dates do not set?


Do you even have a history?
 
History? In short, something uploads for testing, but not less than H1, and then a period of about a month from now and back. Okay, I'm not testing on fx start, where I have a real account, but on an emf trader, where I have a demo account. It's better there so far.
 

Help me to improve the code. The idea is to get a robot that sets a custom TP and SL for all orders (open and pending)

if (OrdersTotal()!=0)
  {
   
   bool   modify;
   int    Done=0;
   for (i = 1; i <= OrdersTotal(); i++)
      {
       if (OrderSelect(i-1,SELECT_BY_POS,MODE_TRADES) == true)
         {
          Stop = OrderStopLoss();
          Take = OrderTakeProfit();
          Print("Пробую модифицировать ",i," ордер (#",OrderTicket(),")");
          modify = OrderModify(OrderTicket(),0,SL,TP,0,0);
          if (modify==true) Done++;
          if (modify==false)
            {
             int error = GetLastError();
             Print("                 Неудача... Ошибка ",error);
             Sleep(5000);
            }
         }
       }
    Alert("Модифицировано  ",Done,"  из  ",OrdersTotal());
    Sleep(10000);
   }

 
Error 130 is coming up for some reason....
 
Noterday:

Help me to improve the code. The idea is to get a robot that sets a custom TP and SL for all orders (open and pending)


Look at the "modify" script - it solves exactly the same problem
 
Noterday:
Error 130 is coming up for some reason....

One question here - check the normalisation of opening prices when placing orders, and for their compliance with min requirements - the tutorial has - see examples here-open and trawl (last two fi's on the page) and here... - requirements and limitations... The most important thing - clarify whether your broker allows for this account immediately, ie at the time of opening orders to put a stop and takeaway, if not, then only after installation and triggering of the order through a modification ... Everything.
 
abolk:

check out the regular "modify" script - it solves exactly the same problem

Ok.

Roman.:

There is one question here - check the normalisation of opening prices when placing orders, as well as for their compliance with min requirements - the tutorial has - see examples here-open and trawl (the last two fi ries on the page) and here... - requirements and limitations... The most important thing - clarify whether your broker allows for this account immediately, ie at the time of opening orders to put a stop and takeaway, if not, then only after installation and triggering of the order through modification ... Everything.
The broker allows that. The broker allows that. And the orders are set manually. I will explain: I do it for convenience, because we sometimes need to set all of them the same TP or SL with 15 open orders. It takes a long time to set them all manually....
Reason: