Discussion of article "MQL5 Cookbook - Multi-Currency Expert Advisor and Working with Pending Orders in MQL5" - page 2

 

While searching for examples of pending orders, I came across this article.

Couldn't the author have the mercy to put a working update here?

If even the MQL5 cookbook doesn't work, how is a beginner supposed to learn anything?

I'm getting a thick throat again!!!!!!!!

 
Otto Pauser:

While searching for examples of pending orders, I came across this article.

Could the author have the mercy to put a functional update here?

If even the MQL5 cookbook doesn't work, how is a beginner supposed to learn anything?

I'm getting a thick throat again!!!!!!!!

Otto, what's your problem?

The article is a bit old, almost half a millennium of updates has passed since then.

I have orientated myself according to:

https://www.metatrader5.com/en/mobile-trading/iphone/help/trade/general_concept/order_types

https://www.mql5.com/en/docs/standardlibrary/tradeclasses/ctrade

and solved it like this:

         tX  = TimeCurrent() + TimeShiftSec; // from input
         cmt = _Symbol+" BU";
         prc = SymbolInfoDouble( _Symbol, SYMBOL_ASK ) - Atr[0]*0.2;
         sl  = prc - StopLoss_*_Point; 
         tp  = prc + TakeProfit_*_Point;
         OrderOpen(_Symbol,ORDER_TYPE_BUY_LIMIT,vol,0.0,prc,sl,tp,ORDER_TIME_GTC,tX,cmt);
Types of Orders - Trading Principles - MetaTrader 5 iPhone/iPad Help
Types of Orders - Trading Principles - MetaTrader 5 iPhone/iPad Help
  • www.metatrader5.com
The MetaTrader 5 mobile platform allows users to prepare and issue requests for the broker to execute trading operations. In addition, the platform allows to control and manage open positions. For this purposes, several types of trade orders are used. An order is an instruction of a brokerage firm's client to conduct a trade operation. In the...
 
What are you looking for otto?
 

I understand Otto...

the thing has not been tested by anyone.

A function is used there that was never declared.

See picture



Code is for the arse :-)

 

Next nonsense...


bool CheckTradingPermission()
  {
//--- For real-time mode
   if(IsRealtime())
     {
      //--- Checking server connection
      if(!TerminalInfoInteger(TERMINAL_CONNECTED))
         return(1);
      //--- Permission to trade at the running programme level
      if(!MQL5InfoInteger(MQL5_TRADE_ALLOWED))
         return(2);
      //--- Permission to trade at the terminal level
      if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED))
         return(3);
      //--- Permission to trade for the current account
      if(!AccountInfoInteger(ACCOUNT_TRADE_ALLOWED))
         return(4);
      //--- Permission to trade automatically for the current account
      if(!AccountInfoInteger(ACCOUNT_TRADE_EXPERT))
         return(5);
     }
//---
   return(0);
  }
//+------------------------------------------------------------------+

Who notices?

 


Now compile it already.


Does anyone know where this function comes from? F1 does not know it. Neither does Google.

MQL5InfoInteger()
Files:
Auxiliary.mqh  7 kb
 
Dokumentation zu MQL5: Zustandspruefung / MQLInfoInteger
Dokumentation zu MQL5: Zustandspruefung / MQLInfoInteger
  • www.mql5.com
Zustandspruefung / MQLInfoInteger - Nachschlagewerk über die Sprache des algothitmischen/automatischen Handels für MetaTrader 5
 
amando:
h ttps:// www.mql5.com/de/docs/check/mqlinfointeger

Take a closer look amando

 

Next error in the code.


Indicator missing ....

It may be that the developer had it, but the one that freshly starts the download does not.


MQ urgently needs to work on this.

The user loses the desire to try it out if he first has to spend 3 hours removing bugs.

 
I still found it on a backup from 2017.
Files:
eventsspy.mq5  8 kb