Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1189

 
Alexey Kozitsyn:

Use OnTradeTransaction().

I trade through the CTrade bible

 
Elena Baranova:

Please suggest an analog of MQL4 function MarketInfo(asymbol, MODE_MARGIN_REQUIRED) in MQL5.

I need to getthe amount of free funds needed to open 1 lot to buy.

I tried different variants of SymbolInfoDouble(symbol, ...) function in MQL5, I can't find the right variant, it returns 0 everywhere.

Here, but I use fxsaber function like this

double AccountFreeMarginCheck(string Symb,int Cmd,double dVolume) {
 double Margin;
   return(::OrderCalcMargin((ENUM_ORDER_TYPE)Cmd, Symb, dVolume,
          ::SymbolInfoDouble(Symb,(Cmd==::ORDER_TYPE_BUY) ? ::SYMBOL_ASK : ::SYMBOL_BID),Margin) ?
          ::AccountInfoDouble(::ACCOUNT_MARGIN_FREE) - Margin : -1);
 }
Документация по MQL5: Торговые функции / OrderCalcMargin
Документация по MQL5: Торговые функции / OrderCalcMargin
  • www.mql5.com
Вычисляет размер маржи, необходимой для указанного типа ордера на текущем счете и при текущем рыночном окружении без учета текущих отложенных ордеров и открытых позиций. Позволяет оценить размер маржи для планируемой торговой операции. Значение возвращается в валюте счета. [out]  Переменная, в которую...
 
Roman Sharanov:

I trade through the CTrade bible

Correct answer:

Why is it so: Help for theCTrade trade class, e.g. openingBuy position

Successful termination of Buy(...) method does not always mean successful execution of the trade operation. It is necessary to check the result of trade request execution (trade serverreturn code) by callingResultRetcode() method as well as value returned byResultDeal() method.


BUT! Even this check will not be enough since only OnTradeTransaction() allows to get transactionTRADE_TRANSACTION_DEAL_ADD - adding a trade to history.


In general, a set is required - send trade request via CTrade, check for success at once and wait for theTRADE_TRANSACTION_DEAL_ADD transaction in OnTradeTransaction().

 
Elena Baranova:

Please suggest an analog of MQL4 function MarketInfo(asymbol, MODE_MARGIN_REQUIRED) in MQL5.

I need to getthe amount of free funds needed to open 1 lot to buy.

I tried different variants of SymbolInfoDouble(symbol, ...) function in MQL5, I can't find the right variant, it returns 0 everywhere.


bool  OrderCalcMargin( 
   ENUM_ORDER_TYPE       action,           // тип ордера 
   string                symbol,           // имя символа 
   double                volume,           // объем 
   double                price,            // цена открытия 
   double&               margin            // переменная для получения значения маржи 
   );
 
Hello, everyone.
I have recently purchased a product in MQLe.
But I can't activate or download them because there is no MARKET tab in MT5 Toolbar. Has anybody had problems with this?
What could be the reason? What is the reason? Or who I can contact on this issue?
Many thanks. Thank you
Files:
 
Vladimir Karputov:

Correct answer:


Why so: Read theCTrade reference, e.g. opening aBuy position


BUT! Even this check will not be enough since only in OnTradeTransaction() we can get transactionTRADE_TRANSACTION_DEAL_ADD - adding a trade to history.


In general, we need a set - send trade request via CTrade, immediately check for success and then wait for transactionTRADE_TRANSACTION_DEAL_ADD in OnTradeTransaction().

thanks

 
Suppose I run genetic optimisation - how do I see the transaction log for each pass?
 
Can you tell me if there is an indicator that would make a mark on candles that have passed 10 pips in a very short time? Well, let's say, to identify impulses. Preferably, it should be drawn directly on the chart on this very candle, and not in a basement indicator
 

In what format should the time for StringToTime() be?


 
Vladimir Karputov:
Suppose I run genetic optimisation - how do I see the transaction log for each pass?

Pass through frames. Ready-made solution here.

Report
Report
  • www.mql5.com
Данная библиотека является несколько переработанной версией замечательного скрипта 2006 года с учетом современных реалий MQL. Некоторые возможности убраны, некоторые - добавлены. В обеих платформах (MetaTrader 4/5) для сохранения отчета (в виде MetaTrader 4) можно запустить такой скрипт: и увидеть в соответствующем файле сформированный...
Reason: