分类
外匯交易的優點與特點

MQL4编程学习之MT4显示任意时间周期指标的使用方法

MQL4 Learning Material for MT4

MQL4 File Functions (MQL4 File Functions Replacement)

A lot of people asked me and MetaQoutes for a better file handling functions that's why I'm writing this article/tool.
The problem of the normal file handling functions was the limited directories you can use for your output file:

Directories limitation:

One of annoying feature of MQL4 file functions is the directories limitation; you can't work with files that outside one of these three directories:

  • Terminal_Install_Dir/HISTORY/
    Works with FileOpenHistory() function.
  • Terminal_Install_Dir/EXPERTS/FILES
    The common directory for file saving and opening.
  • Terminal_Install_Dir/TESTER/FILES
    The directory of testing files.

MetaTrader thinks it's safer to limit the directories you can access from the normal MQL4 program and give you the ability to write your MQL4 extension (dll) to do what do you want. That's why our tool today is useful because it enables you to work with files outside the limited directories of MQL4.

The package:

Please download the full package which includes:
The source code and the compiled version (dll) of MQL4编程学习之MT4显示任意时间周期指标的使用方法 the mtguru1.dll which is a MetaTrader extension that wrote in Visual c++.
gFiles.mqh is the include file which have the declarations of the functions inside the dll.
FilesDemo.mq4 is a demo indicator to show you how to use the dll.

Installation:

  1. Extract all of the contain of MQL4编程学习之MT4显示任意时间周期指标的使用方法 zip file to an empty folder.
  2. Copy the mtguru1.dll to "MQL4编程学习之MT4显示任意时间周期指标的使用方法 MetaTrader 4\experts\libraries" path.
  3. Copy FilesDemo.mq4 to "MetaTrader 4\experts\indicators" path and compile it.
  4. Copy gFiles.mqh to "MetaTrader 4\experts\include".
  5. Load FilesDemo.mq4from your Indicators - don't forget to enable "Allow DLL Import"

The functions we have:

This is a list of the functions the current version of the mtguru1.dll has:
int gFileOpen(string file_name,int mode);
bool gFileWrite(int handle,string data);
bool gFileClose(int handle);
string gFileRead(int handle,int length=0);
void gFileSeek(int handle,int offset, int mode);
bool gFileDelete(string file_name);
int gFileSize(int handle);
int gFileTell(int handle);
bool gFileFlush(int handle);
bool gFileCopy(string source,string distance,bool IfExists);
bool gFileMove(string source,string distance);

They are very like the normal MQL4 functions but you can write in any directory you want. Please play with them and tell me MQL4编程学习之MT4显示任意时间周期指标的使用方法 MQL4编程学习之MT4显示任意时间周期指标的使用方法 your comment!

dll to transfer data to/from excel

I want to build a dll to send indicators values and prices to excel, process them in excell and send back orders to mt4 (I want short response rates). My MQL4编程学习之MT4显示任意时间周期指标的使用方法 question is related to the big concept of sending receiving data.

Should I use c++ to build the dll? Many posts mention that c++ works MQL4编程学习之MT4显示任意时间周期指标的使用方法 fine with mt4, while c# need a wrapper. On the excel side using MQL4编程学习之MT4显示任意时间周期指标的使用方法 c# has advantages?

How should I move the data? wrtting it in files? keeping it in memory? Is sockets the way to go?

Any advice on the best architecture is greatly appreciated.

  • Objects - Charts - MetaTrader MQL4编程学习之MT4显示任意时间周期指标的使用方法 5 for Android
  • Learn how to design a trading system by Bear's Power
  • MQL4 Learning
  • Free trading apps
  • Free Forex VPS for 24 hours
  • Over 8,000 signals for copying
  • Economic news for exploring financial markets

Allow the use of cookies to log in to the MQL5.com website.

Please enable the necessary setting in your browser, otherwise you will not be able to log in.

rahuldhangar/learn-mql4

This commit does not belong to any branch MQL4编程学习之MT4显示任意时间周期指标的使用方法 on this repository, and may belong to a fork outside of the repository.

Use Git or checkout with SVN using the web URL.

Work fast MQL4编程学习之MT4显示任意时间周期指标的使用方法 with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit MQL4编程学习之MT4显示任意时间周期指标的使用方法 information.

README.md

MQL4 Learning Material for MT4

This repo is a collection of MQL4编程学习之MT4显示任意时间周期指标的使用方法 code snippets to learn MQL4 language for MT4 platform

Who can benefit from MQL4编程学习之MT4显示任意时间周期指标的使用方法 stuffs in this repo?

Anyone who is interested to learn basics of MQL4 MQL4编程学习之MT4显示任意时间周期指标的使用方法 language and develop either of the following:

  • Expert Advisor (template)
  • MQL4编程学习之MT4显示任意时间周期指标的使用方法
  • Custom Indicator
  • Script
  • Library
  • Include (*.mqh)
  • New Class
  • Windows PC (with min 1GB RAM, Core i3 CPU and Windows 7 OS)
  • Meta Trader MQL4编程学习之MT4显示任意时间周期指标的使用方法 4 (can be downloaded from any Forex broker)
  • Demo account with a Forex broker (or Live account for that matter)

This project is licensed under the GNU GPL version 2 - see https://opensource.org/licenses/GPL-2.0 MQL4编程学习之MT4显示任意时间周期指标的使用方法 for details

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” MQL4编程学习之MT4显示任意时间周期指标的使用方法 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE MQL4编程学习之MT4显示任意时间周期指标的使用方法 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN MQL4编程学习之MT4显示任意时间周期指标的使用方法 NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR MQL4编程学习之MT4显示任意时间周期指标的使用方法 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN MQL4编程学习之MT4显示任意时间周期指标的使用方法 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MQL4 File Functions (MQL4 File Functions Replacement)

A lot of people asked me and MetaQoutes for a better file handling functions that's why I'm writing this article/tool.
The problem of the normal MQL4编程学习之MT4显示任意时间周期指标的使用方法 file handling functions was the limited directories you can use for your output file:

Directories limitation:

One of annoying feature of MQL4 file functions is the directories limitation; you can't work with files that outside one of these three directories:

  • Terminal_Install_Dir/HISTORY/
    Works with FileOpenHistory() function.
  • Terminal_Install_Dir/EXPERTS/FILES
    The common MQL4编程学习之MT4显示任意时间周期指标的使用方法 directory for file saving and opening.
  • Terminal_Install_Dir/TESTER/FILES
    The directory of testing files.

MetaTrader thinks it's safer to limit the directories you can access from the MQL4编程学习之MT4显示任意时间周期指标的使用方法 normal MQL4 program and give you the ability to write your MQL4 MQL4编程学习之MT4显示任意时间周期指标的使用方法 extension (dll) to do what do you want. That's why our tool today is useful because it enables you to work with files outside MQL4编程学习之MT4显示任意时间周期指标的使用方法 MQL4编程学习之MT4显示任意时间周期指标的使用方法 the limited directories of MQL4.

The package:

Please download the full package which MQL4编程学习之MT4显示任意时间周期指标的使用方法 includes:
The source code and the compiled version (dll) of the mtguru1.MQL4编程学习之MT4显示任意时间周期指标的使用方法 dll which is a MetaTrader extension that wrote in Visual c++.
gFiles.mqh MQL4编程学习之MT4显示任意时间周期指标的使用方法 is the include file which have the declarations of the functions inside the dll.
FilesDemo.mq4 is a demo indicator to show you how to use the dll.

Installation:

  1. Extract all of the contain of zip file to an empty folder.
  2. Copy the mtguru1.dll to "MetaTrader 4\experts\libraries" path.
  3. Copy FilesDemo.mq4 to "MetaTrader 4\experts\indicators" path and compile it.
  4. MQL4编程学习之MT4显示任意时间周期指标的使用方法 MQL4编程学习之MT4显示任意时间周期指标的使用方法
  5. Copy gFiles.mqh to "MetaTrader 4\experts\include".
  6. Load FilesDemo.mq4from your Indicators - don't forget to enable "Allow DLL Import"

The functions we have:

This is a list of the functions the current version of the mtguru1.MQL4编程学习之MT4显示任意时间周期指标的使用方法 dll has:
int gFileOpen(string file_name,int mode);
bool gFileWrite(int handle,string data);
bool gFileClose(int handle);
string gFileRead(int handle,int length=0);
void gFileSeek(int handle,int offset, int mode);
bool gFileDelete(string file_name);
int MQL4编程学习之MT4显示任意时间周期指标的使用方法 gFileSize(int handle);
int gFileTell(int handle);
bool gFileFlush(int handle);
bool gFileCopy(string source,string distance,bool IfExists);
bool gFileMove(string source,string distance);

They are very like the normal MQL4 functions but you can write in MQL4编程学习之MT4显示任意时间周期指标的使用方法 any directory you want. Please play with them and tell me your comment!