거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
조회수:
33304
평가:
(128)
게시됨:
2016.10.10 15:31
업데이트됨:
2021.06.02 08:33
\MQL5\Experts\ \MQL5\Include\
MT4Orders.mqh (220.2 KB) 조회
\MQL5\Scripts\
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

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

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/16006

i-CAiChannel i-CAiChannel

The Envelopes indicator with the use of the i-CAi indicator algorithm.

i-CAi_Digit i-CAi_Digit

The 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.

i-CAiChannel_System_Digit i-CAiChannel_System_Digit

The indicator implements a breakthrough system using the i-CAiChannel channel.

Exp_i-CAi_StDev Exp_i-CAi_StDev

Trading system based on the signals of the i-CAi_StDev indicator.