Questions from Beginners MQL5 MT5 MetaTrader 5 - page 894

 
Vladimir Karputov:

The solution is as follows: in the signals module


In the Expert Advisor that was generated by the MQL5 Wizard:


Bottom Line:


Vladimir, is it then necessary to manually insert a part of the code into the EA every time you recompile it?

 
Andy:

Vladimir, do you have to manually insert a part of the code into the EA every time you recompile it?

No, after you have inserted the enum listing into the EA code, you can compile it as much as you want. The code stays in place, and the inserted part does not go anywhere.

 
If you make changes to the signal module, compile it or add another module, and then create the EA again - then the MKL5 wizard will write the main EA code and again all the changes will be manually added to the generated EA?!
 
Andy:

Could you please tell me where to find an example?

Where in the signal module toinsert the code of the input parameter as an enumeration, so that it can then be specified in the descriptor of that module.

Example: https://www.mql5.com/ru/code/19025

#property description "The script sets the pending orders down from the price"
#property script_show_inputs
//---
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>  
CTrade         m_trade;                      // trading object
CSymbolInfo    m_symbol;                     // symbol info object
//+------------------------------------------------------------------+
//| Enum pending orders DOWN                                         |
//+------------------------------------------------------------------+
enum ENUM_PENDING_ORDERS_DOWN
  {
   buy_limit         =0,   // Buy Limit
   sell_stop         =3    // Sell Stop
  };
//--- input parameters
input ushort                     InpDownGep        = 15;             // Gap for pending orders DOWN from the current price (in pips)
input ushort                     InpDownStep       = 30;             // Step between orders DOWN (in pips)
input ENUM_PENDING_ORDERS_DOWN   InpDownOrders     = sell_stop;      // Type of pending orders DOWN
Pending orders DOWN
Pending orders DOWN
  • votes: 25
  • 2017.08.28
  • Vladimir Karputov
  • www.mql5.com
Скрипт "Pending orders DOWN" выставляет сетку ордеров ВНИЗ от текущей цены. Входные параметры Gap for pending orders DOWN from the current price (in pips) - отступ от текущей цены для первого отложенного ордера; Step between orders DOWN (in pips) - шаг между отложенными ордерами; Type of pending orders DOWN - тип отложенного ордера (может быть...
 

Thanks, I'll have a look now. But it's not a module for standard library and wizard.

Let me clarify my question - is it possible to use my enum in a signal module created in MQL5 Wizard?

 

Netting account, three trades were made in the same direction, with the same lot, with the same number of pips. willthe position price always be equal to the price of the average (second) trade?

Is the position price always the average price of all trades?

 
Sile Si:
Netting account, three trades are executed, in one direction, with equal lot, with equal number of pips. willthe position price always be equal to the price of the average (second) trade?

On forex, I think so (after all 3 trades, of course), on FORTS, no. There will be position reopening after clearing.

 
Sile Si:

Is the price of a position always the average price of all transactions?

It depends on the volume!

 
Alexey Kozitsyn:

There will be a reopening of the position after clearing.

But its price will not change.

 
Sile Si:

But its price will not change.

It will! It will close the previous position and open a new one. But this is on the FORTS!