How to Start with Metatrader 5 - page 119

 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 platform build 1930: Floating window charts and .Net libraries in MQL5

MetaQuotes Software Corp., 2018.10.25 17:24

The updated version of the MetaTrader 5 platform will be released on October 26, 2018. The update will feature the following changes:


  1. Terminal: Now you can detach financial symbol charts from the trading terminal window.

    This feature is convenient when using multiple monitors. Thus, you may set the main platform window on one monitor to control your account state, and move your charts to the second screen to observe the market situation. To detach a chart from the terminal, disable the Docked option in its context menu. After that, move the chart to the desired monitor.




    A separate toolbar on detached charts allows applying analytical objects and indicators without having to switch between monitors. Use the toolbar context menu to manage the set of available commands or to hide it.

  2. Terminal: Fully updated the built-in chats. Now they support group dialogs and channels. Conduct private discussions with a group of people in a unified environment without switching between different dialogs and create channels according to your interests and languages. Communicate with colleagues and friends at MQL5.community without visiting the website.

    Group chats and channels can be public or private. Their creators decide whether it is possible to join them freely or only by invitation. You can also assign moderators to channels and chats for additional communication control.



  3. Terminal: Added support for extended volume accuracy for cryptocurrency trading. Now the minimum possible volume of trading operations is 0.00000001 lots. The market depth, the time and sales, as well as other interface elements now feature the ability to display volumes accurate to 8 decimal places.

    The minimal volume and its change step depend on financial instrument settings on the broker's side.



  4. Terminal: Added the tab of articles published on MQL5.community to the Toolbox window. Over 600 detailed materials on the development of trading strategies in MQL5 are now available directly in the terminal. New articles are published every week.



  5. Terminal: Added support for extended authentication using certificates when working under Wine.
  6. Terminal: Fixed display of the market depth when it is limited to one level.
  7. Terminal: Added the "Save As Picture" command to the Standard toolbar. Now, it is much easier to take pictures of charts and share them in the community.



  8. Terminal: Fixed applying the time shift when importing bars and ticks. Previously, the shift was not applied in some cases.



  9. Terminal: Fixed terminal freezing in case of a large amount of economic calendar news.
  10. MQL5: Added native support for .NET libraries with "smart" functions import. Now .NET libraries can be used without writing special wrappers — MetaEditor does it on its own.

    To work with .NET library functions, simply import DLL itself without defining specific functions. MetaEditor automatically imports all functions it is possible to work with:
    • Simple structures (POD, plain old data) — structures that contain only simple data types.
    • Public static functions having parameters, in which only simple types and POD structures or their arrays are used

    To call functions from the library, simply import it:
    #import "TestLib.dll"
    
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       int x=41;
       TestClass::Inc(x);
       Print(x);
      }
    The C# code of the Inc function of the TestClass looks as follows:
    public class TestClass
    {
       public static void Inc(ref int x)
       {
        x++;
       }
    }
    As a result of execution, the script returns the value of 42.

    The work on support for .NET libraries continues. Their features are to be expanded in the future.

  11. MQL5: Added support for working with WinAPI functions to Standard Library. Now, there is no need to import libraries manually and describe function signatures to use operating system functions in an MQL5 program. Simply include the header file from the MQL5\Include\WinAPI directory.

    WinAPI functions are grouped in separate files by their purpose:

    • libloaderapi.mqh — working with resources
    • memoryapi.mqh — working with memory
    • processenv.mqh — working with environment
    • processthreadsapi.mqh — working with processes
    • securitybaseapi.mqh — working with OS security system
    • sysinfoapi.mqh — obtaining system information
    • winbase.mqh — common functions
    • windef.mqh — constants, structures and enumerations
    • wingdi.mqh — working with graphical objects
    • winnt.mqh — working with exceptions
    • winreg.mqh — working with the registry
    • winuser.mqh — working with windows and interface
    • errhandlingapi.mqh — handling errors
    • fileapi.mqh — working with files
    • handleapi.mqh — working with handles
    • winapi.mqh — including all functions (WinAPI header files)

    The binding works only with the 64-bit architecture.

  12. MQL5: Added support for the inline, __inline and __forceinline specifiers when parsing code. The presence of the specifiers in the code causes no errors and does not affect the compilation. At the moment, this feature simplifies transferring С++ code to MQL5.
    Find more information about specifiers in MSDN.

  13. MQL5: Significantly optimized execution of MQL5 programs. In some cases, the performance improvement can reach 10%. Recompile your programs in the new MetaEditor version to make them run faster.
    Unfortunately, new programs will not be compatible with previous terminal versions due to this additional optimization. Programs compiled in MetaEditor version 1910 and later cannot be launched in terminal version 1880 and below. Programs compiled in earlier MetaEditor versions can run in new terminals.

  14. MQL5: Significantly optimized multiple MQL5 functions.
  15. MQL5: Added new properties for attaching/detaching charts from the terminal main window and managing their position.

    Added the following properties to the ENUM_CHART_PROPERTY_INTEGER enumeration:

    • CHART_IS_DOCKED — the chart window is docked. If set to 'false', the chart can be dragged outside the terminal area.
    • CHART_FLOAT_LEFT — the left coordinate of the undocked chart window relative to the virtual screen.
    • CHART_FLOAT_TOP — the upper coordinate of the undocked chart window relative to the virtual screen.
    • CHART_FLOAT_RIGHT — the right coordinate of the undocked chart window relative to the virtual screen.
    • CHART_FLOAT_BOTTOM — the bottom coordinate of the undocked chart window relative to the virtual screen.

    Added the following functions to the ENUM_TERMINAL_INFO_INTEGER enumeration:

    • TERMINAL_SCREEN_LEFT — the left coordinate of the virtual screen. A virtual screen is a rectangle that covers all monitors. If the system has two monitors ordered from right to left, then the left coordinate of the virtual screen can be on the border of two monitors.
    • TERMINAL_SCREEN_TOP — the top coordinate of the virtual screen.
    • TERMINAL_SCREEN_WIDTH — terminal width.
    • TERMINAL_SCREEN_HEIGHT — terminal height.
    • TERMINAL_LEFT — the left coordinate of the terminal relative to the virtual screen.
    • TERMINAL_TOP — the top coordinate of the terminal relative to the virtual screen.
    • TERMINAL_RIGHT — the right coordinate of the terminal relative to the virtual screen.
    • TERMINAL_BOTTOM — the bottom coordinate of the terminal relative to the virtual screen.

  16. MQL5: Added the volume_real field to the MqlTick and MqlBookInfo structures. It is designed to work with extended accuracy volumes. The volume_real value has a higher priority than 'volume'. The server will use this value, if specified.

    struct MqlTick
      {
       datetime         time;            // Last price update time
       double           bid;             // Current Bid price
       double           ask;             // Current Ask price
       double           last;            // Current price of the Last trade
       ulong            volume;          // Volume for the current Last price
       long             time_msc;        // Last price update time in milliseconds
       uint             flags;           // Tick flags
       double           volume_real;     // Volume for the current Last price with greater accuracy
      };

    struct MqlBookInfo
      {
       ENUM_BOOK_TYPE   type;            // order type from the ENUM_BOOK_TYPE enumeration
       double           price;           // price
       long             volume;          // volume
       double           volume_real;     // volume with greater accuracy
      };

  17. MQL5: Added new properties to the ENUM_SYMBOL_INFO_DOUBLE enumeration:

    • SYMBOL_VOLUME_REAL — the volume of the last executed deal;
    • SYMBOL_VOLUMEHIGH_REAL — the highest deal volume for the current day;
    • SYMBOL_VOLUMELOW_REAL — the lowest deal volume for the current day.

    Use the SymbolInfoDouble function to get these properties.

  18. MQL5: Added the MQL_FORWARD property to the ENUM_MQL_INFO_INTEGER enumeration — forward test mode flag.
  19. MQL5: Added the pack( integer_value ) property for structures. It allows you to set the alignment of the fields arrangement within a structure, which can be necessary when working with DLL. The values of 1, 2 ,4 ,8 and 16 are possible for integer_value.
    If the property is not defined, the default alignment of 1 byte is used — pack(1).

    Example of use:
    //+------------------------------------------------------------------+
    //| Default packing                                                  |
    //+------------------------------------------------------------------+
    struct A
      {
       char              a;
       int               b;
      };
    //+------------------------------------------------------------------+
    //| Specified packing                                                |
    //+------------------------------------------------------------------+
    struct B pack(4)
      {
       char              a;
       int               b;
      };
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       Print("sizeof(A)=",sizeof(A));
       Print("sizeof(B)=",sizeof(B));
      }
    //+------------------------------------------------------------------+
    Conclusion:
    sizeof(A)=5
    sizeof(B)=8
    Find more information about alignment within structures in MSDN.

  20. MQL5: Relaxed requirements for casting enumerations. In case of an implicit casting, the compiler automatically substitutes the value of a correct enumeration and displays a warning.

    For the following code:
    enum Main
      {
       PRICE_CLOSE_,
       PRICE_OPEN_
      };
    
    input Main Inp=PRICE_CLOSE;
    //+------------------------------------------------------------------+
    //| Start function                                                   |
    //+------------------------------------------------------------------+
    void OnStart()
      {
      }
    The compiler displays the warning:
    implicit conversion from 'enum ENUM_APPLIED_PRICE' to 'enum Main'
    'Main::PRICE_OPEN_' instead of 'ENUM_APPLIED_PRICE::PRICE_CLOSE' will be used
    Previously, the following error was generated in that case:
    'PRICE_CLOSE' - cannot convert enum
    The compiler will still display the error if enumerations are used incorrectly in the function parameters.

  21. MQL5: Fixed compilation of template functions. Now, when using overloaded template functions, only the necessary overload, rather than all existing ones, is instantiated.
    class X {  };
    
    void f(int)  {  }
      
    template<typename T>
    void a(T*) { new T(2); }  // previously, the compiler generated the error here
      
    template<typename T>
    void a()  { f(0); }
      
      
    void OnInit()  { a<X>(); }  

  22. MQL5: Optimized some cases of accessing tick history via the CopyTicks* functions.
  23. MQL5: Added the new TesterStop function allowing for early completion of a test/optimization pass. When calling it, the entire trading statistics and OnTester result are passed to the client terminal just like during the normal test/optimization completion.
  24. MQL5: Added the new property for custom indicators #property tester_everytick_calculate. It is used in the strategy tester and allows for forced indicator calculation at each tick.
  25. Tester: Now, in case of a non-visual test/optimization, all used indicators (standard and custom ones) are calculated only during a data request. The exceptions are indicators containing the EventChartCustom function calls and applying the OnTimer handler. Previously, all indicators were unconditionally calculated in the strategy tester at each incoming tick (even from some other instrument). The new feature significantly accelerates testing and optimization.

    To enable the forced indicator calculation at each tick, add the #property tester_everytick_calculate property for the program.
    Indicators compiled using the previous compiler versions are calculated as before — at each tick.

  26. Tester: Fixed calculating the deposit currency accuracy when testing/optimizing and generating relevant reports.
  27. Tester: Optimized and accelerated the strategy tester operation.
  28. Tester: Fixed a few testing and optimization errors.
  29. MetaEditor: Fixed search for entire words. Now when searching, the underscore is counted as a regular character, rather than a word delimiter.
  30. Updated documentation.

The update will be available through the Live Update system.


 

Use tips - the instruction about HowTo

=========

----------------

----------------

----------------

 

New article was published - 

----------------

Modeling time series using custom symbols according to specified distribution laws  

The MetaTrader 5 trading terminal allows creating and using custom symbols in work. Traders have the ability to test their own currency pairs and other financial instruments. The article proposes ways of creating and removing custom symbols, generation of ticks and bars according to the specified distribution laws.


It also proposes methods for simulating the trend and various chart patterns. Proposed ready-made scripts for working with custom symbols with minimal settings allow traders who do not have MQL5 programming skills to use the full potential of custom symbols.

 

How to close the charts (to delete the charts with the indicators/EA attached) if Metatrader is closed -

Forum on trading, automated trading systems and testing trading strategies

How to remove indicator when MT5 closes?

Sergey Golubev, 2018.09.28 16:16

I can explain:

-----------------

1. I open two charts on MT5 - 


2. I close MT5.

3. go to data folder - MQL5 folder - Profiles folder - Charts folder - Defauls folder

and delete two profiles (delete two charts) - 


and after you open MT5 - I will not have those two charts - 

----------------

So, if you do not want to load the indicators on some chart (in case MT5 is closed) so - close the chart with indicators.


 

Just about Metatrader 5 in 2018 - the news -

----------------

News - MetaQuotes Software Corp.
News - MetaQuotes Software Corp.
  • www.metatrader5.com
FXOpen launched MetaTrader 5 with hedging on ECN accounts The forex broker FXOpen has offered their clients access to ECN trading and interbank liquidity via MetaQuotes Software's new platform. This is the company's next strategic step of continuous investment in trading technology. FXOpen launched the brokerage service back in 2005...
 

As many people are continuing asking about "How to open account with MT5" and "How to add the broker to MT5" so I want to remind the following links:

MetaTrader 5 Help - Open an Account

MetaTrader 5 Android OS Help - Opening a Demo Account 

MetaTrader 5 iPhone/iPad HelpConnecting to an Account and Opening a Demo Account 

-----------------

Simplified way to request a real account in MetaTrader 5 Android 

-----------------

Open an Account - Getting Started - MetaTrader 5
Open an Account - Getting Started - MetaTrader 5
  • www.metatrader5.com
Two types of accounts are available in the trading platform: demonstration (demo) and real. Demo accounts provide the opportunity to work in a training mode without real money, allowing to test a trading strategy. They feature all the same functionality as the live ones. The difference is that demo accounts can be opened without any investment...
 

MetaQuotes ID in MetaTrader Mobile Terminal 

Android and iOS powered devices offer us many features we do not even know about. One of these features is push notifications allowing us to receive personal messages, regardless of our phone number or mobile network operator. MetaTrader mobile terminal already can receive such messages right from your trading robot. You should only know MetaQuotes ID of your device. More than 9 000 000 mobile terminals have already received it.

The world around us is constantly changing. Few people remember paging, though it was extremely popular at the time. GSM phones granted us the ability to send SMS messages to any cellular network user and paging was soon forgotten. 

Can we long for more? Yes, we can! We can expand our opportunities even further with push notifications - the new service provided by modern smartphones.

MetaQuotes ID in MetaTrader Mobile Terminal
MetaQuotes ID in MetaTrader Mobile Terminal
  • www.mql5.com
Android and iOS powered devices offer us many features we do not even know about. One of these features is push notifications allowing us to receive personal messages, regardless of our phone number or mobile network operator. MetaTrader mobile terminal already can receive such messages right from your trading robot. You should only know...
 

Interesting article was published - 

----------------

Gap - a profitable strategy or 50/50?

Here we will deal with checking D1 gaps on stock markets. How often does the market continue to move in the direction of a gap? Does the market reverse after a gap? I will try to answer these questions in the article, while custom CGraphic graphs will be used to visualize the results. Symbol files are selected using the system GetOpenFileName DLL function.

Gap - a profitable strategy or 50/50?

When analyzing several securities markets, I saw that after a gap, the probabilities of a continued movement and a reversal are close to 50%, which means trying to catch a gap has the 50/50 success rate. At the same time, there are securities with the probabilities (of both continuation and reversal) considerably higher than 65%. These securities can be used to trade gaps.

 
Sergey Golubev:

I decided to create this thread to help to myself and to the others to start with Metatrader 5.

I am experienced in MT4 and in forex in general (i hope : ) but we traders really need to collect all the information about it in one place.
I will make some posts about 'how I am starting with MT5'. :)

Please make your any question about Metatrader 5 and I will try to answer them,
or we will reply all together.



 

Congrats for the thread. Great one!