Unisciti alla nostra fan page
MT4Orders - libreria per MetaTrader 5
- Visualizzazioni:
- 35509
- Valutazioni:
- Pubblicato:
- 2016.10.10 15:31
- Aggiornato:
- 2021.06.02 08:33
- Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance
This library allows to work with the orders in MQL5 (MT5-hedge) in the same way as in MQL4.
That is, the order language system (OLS) becomes identical to MQL4. At the same time, it is still possible to use the MQL5 order system in parallel. In particular, the standard MQL5 library will continue to fully operate.
It is not necessary to choose between the order systems. Use them in parallel! When translating MQL4 -> MQL5, there is no need to touch the order system at all.
It is sufficient to add a single line at the beginning:
#include <MT4Orders.mqh> // if there is #include <Trade/Trade.mqh>, add this line AFTER that
Similar actions (adding one line) in your MQL5 codes allow to add the MT4 OLS to the MT5 OLS, or completely replace it.
The author had created this feature for himself, therefore, he deliberately had not applied the same idea of "one-line" transfer for timeseries, graphical objects, indicators, etc.
This work covers only the order system.
The task of possibility to create a complete library for allowing the MQL4 code to work in MetaTrader 5 without changes had not been considered.
As an example, multiple MT4/5 Expert Advisors (from the codebase) of different types have been used: scalpers, news trading experts, martingales, multi-currency experts, etc.
Here (parallelism of the MT4 and MT5 OLS) is how they can be used in the MT5 tester (or demo):
// MQL4&5-code #define OnTick MTstart #define start MTstart #ifdef __MQL5__ // Select the required MT5 EA // #include "Lucky.mq5" // https://www.mql5.com/en/code/1107 // #include "Puria.mq5" // https://www.mql5.com/en/code/138 // #include "Ilan_1_6_Dynamic_HT.mq5" // https://www.mql5.com/en/code/12220 // #include "Multik.mq5" // https://www.mql5.com/en/code/158 // #include "VLT_Trader.mq5" // https://www.mql5.com/en/code/1163 // #include "Exp_PFE_Extr.mq5" // https://www.mql5.com/en/code/16044 #endif // __MQL5__ #include <MT4Orders.mqh> // if there is #include <Trade/Trade.mqh>, add this line AFTER that #include <MQL4_to_MQL5.mqh> // ONLY for this example // Select the required MT4 EA // #include "Lucky.mq4" // https://www.mql5.com/en/code/7464 // #include "E-news-lucky6.mq4" // https://www.mql5.com/en/code/7672 // #include "cm_ea_news.mq4" // https://www.mql5.com/en/code/10511 // #include "Spreader_v2.mq4" // https://www.mql5.com/en/code/14500 #include "Ilan1_4_strict.mq4" // #property strict (MQL5), original - https://www.mql5.com/en/code/8492 #include "OrdersToString.mqh" #undef OnTick void OnTick( void ) { ::MTstart(); if (MQLInfoInteger(MQL_VISUAL_MODE)) Comment("Trade:" + OrdersToString() + "\nHistory:" + OrdersToString(MODE_HISTORY)); // can be viewed in visual mode of the tester return; }
If earlier it was possible to test the MT4 experts on real ticks in the MetaTrader 4 tester, now the MT5 tester has the multi-currency capabilities. That is, the multi-currency MT4 experts can now be tested directly in the tester!
An additional example is a statistical script, collected from multiple MT4 samples:
// MQL4&5-code #include <MT4Orders.mqh> // if there is #include <Trade/Trade.mqh>, add this line AFTER that #include <MQL4_to_MQL5.mqh> // ONLY for this example #ifdef __MQL5__ #property script_show_inputs void OnStart( void ) { ::OnStartScript(); // TradingSystemRating_Script_Ad.mq4 ::WriteDealsInfo(); // b-SharingDoW.mqh // Report_strict.mq4 ::init(); ::start(); ::deinit(); MessageBox("Look in MQL5\\Files"); return; } #endif // __MQL5__ #define OnStart OnStartScript #include "TradingSystemRating_Script_Ad.mq4" // https://www.mql5.com/en/code/12040 #include <b-SharingDoW.mqh> // https://www.mql5.com/en/code/8090 sinput int MAGIC = 0; // MagicNumber of the evaluated orders (b-SharingDoW.mqh) // Disregard the Warnings - script has been written in 2006... #define i ii // avoid the Warnings part #include "Report_strict.mq4" // #property strict (MQL5), original - https://www.mql5.com/en/code/8126
Tradotto dal russo da MetaQuotes Ltd.
Codice originale https://www.mql5.com/ru/code/16006
The Envelopes indicator with the use of the i-CAi indicator algorithm.
i-CAi_DigitThe i-CAi indicator displays the most recent value as a price label with the the possibility to round the channel levels up to a required number of digits.
The indicator implements a breakthrough system using the i-CAiChannel channel.
Exp_i-CAi_StDevTrading system based on the signals of the i-CAi_StDev indicator.