Questions from Beginners MQL5 MT5 MetaTrader 5 - page 924

 
Nauris Zukas:

Without the change, theMQl5 Help does not open.

Do you have a fast internet connection? If help is not opening, it means that it is being downloaded. There used to be messages in the Logbook about the upload process, now the messages have been removed.

 

Can you tell me please!!!

What to write in iCustom after the indicator name?

 
TaywinLannister:

Can you tell me please!!!

What should I write in iCustom after the indicator name?

Search through examples with code: iCustom

 
TaywinLannister:

Can you tell me please!!!

What to write in iCustom after the indicator name?

Help on the website.
Документация по MQL5: Технические индикаторы / iCustom
Документация по MQL5: Технические индикаторы / iCustom
  • www.mql5.com
[in] input-параметры пользовательского индикатора, разделенные запятыми. Тип и порядок следования параметров должен соответствовать. Если параметры не указаны, то будут использованы значения по умолчанию. INVALID_HANDLE. Для освобождения памяти компьютера от неиспользуемого больше индикатора служит функция IndicatorRelease(), которой...
 
foreXteller:

Dear Vladimir Karputov!

Thank you for the link!

I looked through your recommended article "TICK GENERATION ALGORITHM IN THE METATRADER 5 TERMINAL TEST".

It's a little different - I don't want to analyze tick values on a minute interval, and the last market values from SymbolInfoTick() are not so important now.

In orderto play with MetaTrader 5 in thefuture , I want to test my strategy (my robot) with my programs on one-minute quotes of several currencies simultaneously, considering theirASK, BID, VOLUME and SPREAD, but not candlesticks.

Since the programs are written in VISUAL C, I can't use MT for testing.

The programs are quite complex and can hardly be translated to MQL (I plan to use DLL files in the future ).

Thanks for your attention!

DearVladimir Karputov!



The article you have recommended is as follows:

"Tick generation algorithm

"The Strategy Tester of the MetaTrader 5 terminal uses only one price simulation mode in testing - the generation of ticks on the basis of the existing historical data on the minute timeframes using the used symbols".

Please advise where to get the"existing historical data on minute timeframes"

Thanks in advance!!!


 

Can you tell me how to catch a position closing event?

void OnTradeTransaction(const MqlTradeTransaction&    trans,
                        const MqlTradeRequest&        request,
                        const MqlTradeResult&         result
                        )
  {
   if(trans.type!=TRADE_TRANSACTION_DEAL_ADD)
      return;
   ...
  }
 
void OnTradeTransaction(const MqlTradeTransaction&    trans,
                        const MqlTradeRequest&        request,
                        const MqlTradeResult&         result
                        )
  {
   if(trans.type!=TRADE_TRANSACTION_DEAL_ADD)
      return;
   if(trans.deal_type!=DEAL_TYPE_BUY && trans.deal_type!=DEAL_TYPE_SELL)
      return;
   ENUM_DEAL_ENTRY entry_type=(ENUM_DEAL_ENTRY)HistoryDealGetInteger(trans.deal,DEAL_ENTRY);
   if(entry_type==DEAL_ENTRY_IN)
      return;
  }

Is this correct? I think a volume check should also be added.

 
foreXteller:

DearVladimir Karputov!



In your recommended article the following is given:

"Tick generation algorithm

The Strategy Tester of the MetaTrader 5 terminal uses only one price simulation mode in testing - the generation of ticks on the basis of the existing historical data on the one-minute timeframes on the used symbols".

Please advise where to get the"existing historical data on minute timeframes"

Thanks in advance!!!


Everything is already there in MetaTrader 5. From the beginning. Right away. As soon as you connect to the trading server - you immediately get access to all of the tick history.

When you work online, of course you work with real ticks. While working in the strategy tester, you can choose the mode: "Every tick is based on real ticks" - the most precise method, the real history ticks, or one of the tick generation modes: "All ticks", "OHLC".

 

Please tell me if there is some universal code that allows to get the profit of positions in the history? At least by pos_id. Which would work on all markets.

 
Juer:

Can you tell me how to catch a position closing event?

For forex I use this option.

/*********************TradeTransaction function**********************/
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
{
  if(trans.type == TRADE_TRANSACTION_DEAL_ADD && trans.symbol == _Symbol)
   {
    /******************** Если открылась позиция********************/
    if(PositionSelectByTicket(trans.position) && PositionGetInteger(POSITION_MAGIC) == magick)
      ifOpenedPosition(trans);
    /******************** Если закрылась позиция********************/
    if(!PositionSelectByTicket(trans.position))
     ifClosedPosition(trans);
   }
}/*******************************************************************/

I.e. the position exists or not.

Juer:

Please tell me, is there a universal code that allows to get the profit of positions in the history? At least by pos_id. It would work in all markets.

Writing one of these is "a piece of cake". You simply select the trades that belong to the position and loop through them to add up the profit, swap and commission.
Reason: