[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 544

 
a11adin >>:
Помогите пожалуйста, локальные переменные в функции start() сбрасывают своё значение при каждом новом тике?

Declare static variables (denoted by static) before calling start()

 
Dear Gurus! Please advise stuck in the wilderness of dummies how to organize order bookkeeping and event tracking on multiple currency pairs and multiple timeframes simultaneously in one EA. Order bookkeeping in a large program and event tracking do not give me any clear answers to my questions. I have not found any answers in the humongous expanses of this wonderful resource. I have never thought that a simple task (simple in my heart) may bring a kettle to a deadlock for so long and irreversibly, and nail it into the wall, that it will not come out... :)
I understand that I should organize review of orders in a loop, but I cannot figure out how to keep track of opened positions and set orders simultaneously for different currency pairs and different timeframes. Damn, I have been stuck in this situation for a month. I made a textbook Expert Advisor, which trades only on one pair and one timeframe, but it, of course, does not fit my TS and does not satisfy the requirements I need for implementing a trading system.
Already a cry for help... Help me to understand it. If only hint, where can I read about it (only, please, don't send me back to the tutorial), and preferably with examples (what a beginner without examples - to feel is always better than to see ...).
I'd be grateful to anyone who responds in any way to the plea for help.
 
How much and what needs to be tracked, write specifically.
 
artmedia70 >>:
Уважаемые гуру! Подскажите застрявшему в дебрях чайнику как организовать учёт ордеров и отслеживание событий по нескольким валютным парам и нескольким ТФ одновременно в одном советнике.....
Буду благодарен всем, кто хоть как-то откликнется на мольбу о помощи.

Perhaps a function (placed outside the START function) can help you track positions:
https://www.mql5.com/ru/forum/107476/page18

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.02.2008                                                     |
//|  Описание : Возвращает количество позиций.                                 |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//+----------------------------------------------------------------------------+
int NumberOfPositions(string sy="", int op=-1, int mn=-1) {
  int i, k=OrdersTotal(), kp=0;

  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderSymbol()==sy || sy=="") {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) kp++;
          } } } } }  return(kp);}
Example (in the Start function):
if (NumberOfPositions("EURUSD", OP_BUY, Magic)>0) {// if there are buy positions on EURUSD,
if (MarketInfo("EURUSD",MODE_BID)>=1.3500) {// if the current price of the Euro has risen above 1.3500 then close them:
ClosePosFirstProfit("EURUSD",OP_BUY,Magic); }} //also with the same function.
 
Can you tell me if it is possible to execute trades without specifying a unique order number? Say modify all the seals this way and the baiji that way.
 

Of course you can.

You can't do it any other way. Sell and buy will always have to be modified separately. Because they are opened at different prices (buy at ask, sell at bid). Stops as well.

 

Professionals, tell me... Is it possible to draw indicator lines as a background. For example, can I add code to draw the MA line below the bars?

 
Good afternoon. Can you please tell me how to make a panel on a chart, on which it would be possible to place several graphical objects. And the coordinates of the objects should change when you move the panel according to the coordinates of the panel. Somewhere I saw an example of this in the codebase, but I can't find it. Thanks for the help
 

This question may seem strange, but I can't find the answer:

Why when working in "automat", with the same SL, TP, the result of the trades are different ? (I don't know why I started working with such trades and I don't know what to do with them.) I would be grateful if you could at least give me a link to the appropriate.

 
kon12 >>:

Профи, подскажите... Можно ли рисовать линии индикаторов как фон. Например добавить код, чтобы линия МА рисовалась под барами?

Properties (F8), General tab, Graph top field.

Reason: