How I assemble my advisor by trial and error - page 30

 
Сергей Криушин:
When I look at the yellow buttons, they should open while I'm busy - buy when you buy, sell when you sell, turn buy off, close Buy Close when you sell and look how much money is in the yellow Buy Close - I figured it out, I don't feel comfortable asking the author ...

It needs to be checked - and configured in the terminal. right now it is impossible to understand what it needs, it does not work properly in the tester. on monday I will figure out what it needs and where.

 
Aleksandr Klapatyuk:

It needs to be checked - and configured in the terminal. right now it is impossible to understand what it needs, it does not work properly in the tester. on monday I will figure out what it needs and where.

i got it wrong. right now the yellow buttons set lines and the lines would go Boo or Sell.

 
Aleksandr Klapatyuk:

here already paired -AVGiS intelligence.mq5195 kb

You try to - in another way, it will not work. you have to rewrite everything without it (CSampleExpert::)--- bool CSampleExpert::Init(void)

So, I'm looking for something that doesn't work... I haveButtonCreate at the top... I put it the same way as in author's code...

 
Сергей Криушин:

So I'm looking at something that's not working... I haveButtonCreate at the top... just like in the author's code...

and this way it will work, just like it did, plus with my

 
Сергей Криушин:

So I'm looking at something that's not working... I haveButtonCreate at the top... the same as in the author's code...

tomorrow - I'll try to glue it together like you're trying .

 
Сергей Криушин:

So I'm looking at something that's not working... I haveButtonCreate at the top... the same as in the author's code...

is it like this ?

I can't insert the code - it won't go in for some reason

Files:
01_AVGiS.mq5  41 kb
 
Darn it, I reinstalled the operating system - now I'm confused with the mt5 codes
 
Aleksandr Klapatyuk:

Do you have one of these?

i can't put the code in

you skip the opening codes, from the top yellow ones...already wrote about it somewhere the post disappeared...)) you need to link them to your signals...

//+------------------------------------------------------------------+  
//|                                                                  |
//+------------------------------------------------------------------+
bool OpenBuy(double tp)
  {
//--- перебор всех открытых позиций
   if(PositionsTotal()<limit_total)
     {
      //--- объявление и инициализация запроса и результата
      MqlTradeRequest request={0};
      MqlTradeResult result={0};
      //--- параметры запроса
      request.action=TRADE_ACTION_DEAL; // тип торговой операции
      request.symbol=Symbol(); // символ
      request.volume=Volume(); // объем в 0.1 лот *((int)MathAbs(main_buffer))
      request.type=ORDER_TYPE_BUY; // тип ордера
      request.price=SymbolInfoDouble(Symbol(),SYMBOL_ASK); // цена для открытия
      request.deviation=5; // допустимое отклонение от цены
      request.magic=EXPERT_MAGIC; // MagicNumber ордера
      //request.sl=SymbolInfoDouble(Symbol(),SYMBOL_BID)-TrailingStop_STOPS_LEVEL*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // Уровень Stop Loss ордера
      //request.tp=SymbolInfoDouble(Symbol(),SYMBOL_BID)+TProf*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // Уровень Take Profit ордера
        
      //--- отправка запроса
      if(!OrderSend(request,result))
         PrintFormat("OrderSend error %d",GetLastError()); // если отправить запрос не удалось, вывести код ошибки
      //--- информация об операции
      PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order);
     };

   return ( true );
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool OpenSell(double tp)
  {
  
//--- перебор всех открытых позиций
   if(PositionsTotal()<limit_total)
     {
      //--- объявление и инициализация запроса и результата
      MqlTradeRequest request={0};
      MqlTradeResult result={0};
      //--- параметры запроса
      request.action=TRADE_ACTION_DEAL; // тип торговой операции
      request.symbol=Symbol(); // символ
      request.volume=Volume(); // объем в 0.1 лот *((int)MathAbs(main_buffer))
      request.type=ORDER_TYPE_SELL; // тип ордера
      request.price=SymbolInfoDouble(Symbol(),SYMBOL_BID); // цена для открытия
      request.deviation=5; // допустимое отклонение от цены
      request.magic=EXPERT_MAGIC; // MagicNumber ордера
      
      //request.sl=SymbolInfoDouble(Symbol(),SYMBOL_ASK)+TrailingStop_STOPS_LEVEL*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // Уровень Stop Loss ордера
      //request.tp=SymbolInfoDouble(Symbol(),SYMBOL_ASK)-TProf*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // Уровень Take Profit ордера
                        
         
           
                    
      //--- отправка запроса
      if(!OrderSend(request,result))
         PrintFormat("OrderSend error %d",GetLastError()); // если отправить запрос не удалось, вывести код ошибки
      //--- информация об операции
      PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order);
     };

   return ( true );
  }
 
Сергей Криушин:

you skip opening codes, from the top yellow ones...already wrote about it somewhere the post disappeared...)) you need to link them to your signals...

they are - I renamedOpenSell(double tp) to TradeSell(double LotsX)

or i originally downloaded another code from the link - that you gave meSpeed-v1.mq548 kb

something - probably different,(double tp) and I downloaded there(double LotsX)

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool TradeBuy(double LotsX)
  {
//--- перебор всех открытых позиций
   if(PositionsTotal()<limit_total)
     {
      //--- объявление и инициализация запроса и результата
      MqlTradeRequest request= {0};
      MqlTradeResult result= {0};
      //--- параметры запроса
      request.action=TRADE_ACTION_DEAL; // тип торговой операции
      request.symbol=Symbol(); // символ
      request.volume=InpLots; // объем в 0.1 лот *((int)MathAbs(main_buffer))
      request.type=ORDER_TYPE_BUY; // тип ордера
      request.price=SymbolInfoDouble(Symbol(),SYMBOL_ASK); // цена для открытия
      request.deviation=5; // допустимое отклонение от цены
      request.magic=Magic_Number; // MagicNumber ордера
      //--- отправка запроса
      if(!OrderSend(request,result))
         PrintFormat("OrderSend error %d",GetLastError()); // если отправить запрос не удалось, вывести код ошибки
      //--- информация об операции
      PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order);
     };
   return (true);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool TradeSell(double LotsX)
  {
//--- перебор всех открытых позиций
   if(PositionsTotal()<limit_total)
     {
      //--- объявление и инициализация запроса и результата
      MqlTradeRequest request= {0};
      MqlTradeResult result= {0};
      //--- параметры запроса
      request.action=TRADE_ACTION_DEAL; // тип торговой операции
      request.symbol=Symbol(); // символ
      request.volume=InpLots; // объем в 0.1 лот *((int)MathAbs(main_buffer))
      request.type=ORDER_TYPE_SELL; // тип ордера
      request.price=SymbolInfoDouble(Symbol(),SYMBOL_BID); // цена для открытия
      request.deviation=5; // допустимое отклонение от цены
      request.magic=Magic_Number; // MagicNumber ордера
      //--- отправка запроса
      if(!OrderSend(request,result))
         PrintFormat("OrderSend error %d",GetLastError()); // если отправить запрос не удалось, вывести код ошибки
      //--- информация об операции
      PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order);
     };
   return (true);
  }
//+------------------------------------------------------------------+

I deleted all unnecessary things and gave the name that was there AVGiS.mq5 and the name in 01 AVGiS.mq5

Snapshot.PNG

 

All right, I'm uploading the files here. I'm restoring the computer now.

and didn't save the last examiner.