Questions from Beginners MQL5 MT5 MetaTrader 5 - page 27

 
Dimka-novitsek:
I don't understand something about position modification, it's not clear from MQL5 Reference. I don't see the corresponding function in the list of trading functions, could someone please give me a code example?
(Could someone please give me a code example? )) Trading Operations in MQL5 is Simple
 
Dimka-novitsek:
I can't understand something about position modification, it's not clear from MQL5 Reference. I don't see the corresponding function in the list of trading functions.

The entire trading functionality is implemented as one function OrderSend(), simply put "set request".

The difference in its behavior depends on the state of MqlTradeRequest structure.

All other functions related to trading are concerned with control of execution.

 
Thank you!!! Really clear simple answer, and a great link, I'm reading it now.
 
Good evening! I am trying to place a buy order. I drew the EA to the chart and got 0 results. I have copied him everything I thought it should be. Actually, everything may be wrong! Let's show an example, please!
//+------------------------------------------------------------------+
//|                                                     ордерній.mq5 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

   MqlTick last_tick;
SymbolInfoTick(_Symbol,last_tick);
double Ask=last_tick.ask;
double Bid=last_tick.bid;

   MqlTradeRequest request={0};
   MqlTradeResult result={0};
   
   request.action= TRADE_ACTION_DEAL;
   request.magic =600;
   request.symbol=Symbol();
   request.volume=1;
   request.sl=Bid-300*Point();
   request.tp=Bid+300*Point();
   request.type=ORDER_TYPE_BUY;
   OrderSend( request,   result    );  

       
  int Error=GetLastError( ) ; ResetLastError();
  printf("Error ",Error);
  
        
  
   
  }
//+------------------------------------------------------------------+
 
Dimka-novitsek:
Good evening, I am trying to place a buy order. I pulled the EA to the chart, the result is 0.
Please make clear statements. What is the meaning of "0 result".
 
I apologise. It doesn't put a position. It doesn't set anything.
 
The issue has been resolved. It was in the terminal that the trade was forbidden, but I didn't know that!
 

Hello.

Can you please tell me if there is any utility program that I can measure the RAM consumption in my machine when running MT5. When running several EAs at the same time, I get peaks in RAM load and "hangs out" the VPS. I can't figure out "what's wrong"? A special "traffic light" starts the EAs one by one, the EAs do not work at full capacity for every tick. The experts have been created with sensible memory usage in mind and the advice in the training articles has been used. But the most important thing is that the terminal worked correctly for more than half a year with a large number of experts. Everything "pulled and rustled". On VPS 1Gb of RAM is not enough now. I would like to run it "in full" and see what resources I need objectively.

Thank you in advance.

 
Документация по MQL5: Стандартная библиотека / Торговые классы / CTerminalInfo / MemoryUsed
Документация по MQL5: Стандартная библиотека / Торговые классы / CTerminalInfo / MemoryUsed
  • www.mql5.com
Стандартная библиотека / Торговые классы / CTerminalInfo / MemoryUsed - Документация по MQL5
 
It would also be desirable to see separately what the memory is spent on: internal structures distributed from mql5, timeseries, indices...
Reason: