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

 
artmedia70:

For some reason the appearance of a TakeProfit does not interrupt the summation. Counts all the minuses in the history.
 
Neron_plus34:
For some reason the appearance of a TakeProfit does not interrupt the summation. It counts all the minuses in the history.
Unfold the loop.
 
artmedia70:
Unfold the loop.
Thank you it works.
 

Hello...I used to trade at ForexClub with MT4 that I downloaded from there... I decided to open another account at InstaForex... but when I connect to another account, the stock quotes screen says "waiting for update" .... I have to choose"open chart" again to open the required screen... I tried to download MT4 from the manufacturer, but then I cannot connect to trading accounts....pis no connection...what am I doing wrong? Please help ....

 
Forexman77:

Thank you, I've done it!

How do I make the indicator redraw after dragging the line?

// Определение LastBar по расположению StopLine на графике
bool fNewStopLine(){
   bool New;
   int StopBar, Error;
   double Shift;
   datetime StopLine;
   if( ObjectFind("StopLine")==0 ){                // Есть стоп-линия
      StopLine=ObjectGet("StopLine",OBJPROP_TIME1);// Время стоп-линии
      StopBar=iBarShift(NULL,0,StopLine);          // Бар стоп-линии
      LastBar=StopBar+1;                           // Бар окончания построения
      if( StopBar<=БарОкончания ){                 //    правее или на последнем баре
         LastBar=БарОкончания;                     // Перенести на нулевой бар
         StopBar=LastBar-1;
         StopLine=Time[StopBar];
         if( !ObjectMove("StopLine",0,StopLine,0) ){
            if( !РежимОтладки ) PlaySound("alert.wav");
            Print("***   StopLine - объект не перемещен, ошибка "+GetLastError());
      }  }
      if( StopLine!=OldStopLine ){                 // Новая стоп-линия
         ReInit();                                 // Повторная инициализация
         ClearScreen();                            // Очистить экран
         Shift=0.01*(WindowPriceMax()-WindowPriceMin())*СдвигИндикатораТиков;
         Error=fArrow("TickIndicator","",0,StopBar // Сформировать индикатор тика
                     ,WindowPriceMin()+Shift,0,0,0,0
                     ,ЗнакИндикатораТиков,ЦветИндикатораТиков,РазмерИндикатораТиков);
         OldStopLine=StopLine;                     // Стоп-линия обработана
         New=true;                                 // Выполнить построение заново
      }
      else{                                        // Нет новой стоп-линии
         New=false;                                // Построение заново не выполнять
   }  }
   else{                                           // Нет стоп-линии
      New=false;                                   // Построение заново не выполнять
      Error=fObjectDelete("TickIndicator");        // Удалить индикатор тика
   }
   return(New);
}
 
tara:

Thank you!
 

I am facing a problem. I am developing my own indicator on the basis of one indicator, but there are some strings which I don't understand and these strings use dll library. If you can tell me in your own words what these lines are for. How can I change them without using dll library? I have highlighted these lines below:

#import "user32.dll"
        int  RegisterWindowMessageA (string lpString); 
        int  PostMessageA           (int hWnd,int Msg,int wParam,int lParam);
                
#define  WM_COMMAND                     0x0111
#import

            int MT4InternalMsg;
            int hwnd;
            string sn; 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   EventSetTimer(60);

  if(MT4InternalMsg == 0)  
         {
         MT4InternalMsg = RegisterWindowMessageA("MetaTrader4_Internal_Message"); 
    }       
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
      
  }

//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
                  hwnd = WindowHandle(Symbol(), 1);
        if(PostMessageA(hwnd, 0x0111, 0x822c, 0) == false)
          {
          hwnd = 0;
          return;
          }
          PostMessageA(hwnd, MT4InternalMsg, 2, 1);    
  }
//+------------------------------------------------------------------+
 
1. How do I open two or more orders at the same time?
2. How do I know that the order has closed on TP or SL and call something on this event?
3. What issues may arise during real trading by the Expert Advisor? Can my TP, SL, pending, etc. not be executed on a server? What would you do in such a case? Where do I store my trade logs reliably (in global variables, in terminal, in files, etc.)?
 
smart_man:
1. How do I open two or more orders at the same time?
2. How do I know if an order is closed by TP or SL, and call something on this event?
3. What issues may arise during real trading by the Expert Advisor? Can my TP, SL, pending, etc. not be executed on a server? What would you do in such a case? Where do I store my trade logs reliably (in global variables, in terminal, in files, etc.)?

Here you can find part of the answers: https://www.mql5.com/ru/forum/131859

 
abeiks:

Here you can find part of the answers: https://www.mql5.com/ru/forum/131859


1. Thanks, but didn't find the answer. There is a SetOrder() function, but it is the same as OrderSend() essentially. You cannot open multiple orders at the same time with this function.
Reason: