GithubHelp home page GithubHelp logo

jafferwilson / mt4-ticks-to-mt5 Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 11.0 289 KB

Copy the tick and history from the MetaTrade 4 to MetaTrader 5

License: GNU Lesser General Public License v3.0

MQL4 3.37% MQL5 96.63%

mt4-ticks-to-mt5's Introduction

MT4-Ticks-To-MT5

Thank you @fxsaber for the Symbol library.

Lets take a look at the instruction for deployment.

In MT5:

1) Copy the complete project in the Experts directory  of the MQL5 as it is.
2) Compile MT5.mq5 once to make sure it is working.

In MT4:

1) Copy the complete project in the Experts Directory of the MQL4 as it is.
2) Copy the sym_port.txt in the MQL4 ---> Files Directory. (I could not load the file from the same folder. So I have to move it to teh files folder. I was not able to find a method for its inclusion, if someone has idea please share so I can neglect this step.)
3) Compile the MT4.mq4 file once to make sure it is working.

Note:

First apply the MT4.mq4 on the chart.
Then apply the MT5 on the chart of the same symbol. Otherwise it will not work.

Have a look at the image: Demo Image

Note:

This is free code and I am always open for suggestions to improve it. I will not permit anyone to make a product and sell the code. Please try remaining ethical.

mt4-ticks-to-mt5's People

Contributors

jafferwilson avatar kenorb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mt4-ticks-to-mt5's Issues

Note on Files directory

From the FileOpen documentation:

For security reasons, work with files is strictly controlled in the MQL4 language. Files with which file operations are conducted using MQL4 means, cannot be outside the file sandbox.

The file is opened in the folder of the client terminal in the subfolder MQL4\files (or Tester\Files in case of testing). If FILE_COMMON is specified among flags, the file is opened in a shared folder for all MetaTrader 4 client terminals.

What is this doing exactly?

@JafferWilson
If this is doing what I think, it is really cool! So plaase clarify.

I can connect my MT4 to my broker, but run my MT5 without a broker connection, and still get the tick charts from the MT4?

What is the purpose and function of the CSV files?

  • What is the intended purpose and function of the CSV files?
    • Do they store the tick or candle data?
    • Are they used to reload old data when starting up?
  • Are the CSV files created and stored in both MT4 and MT5 sides?

FAQ

  • Q: Can we also pump data in the reverse direction?
    (I.e. using MT5 as tick source and push to be shown in MT4, by switching the EA's.)

  • Q: I would like to use a different tick-data source to push ticks to MT5 (or MT4 if allowed by above), can this be done?
    (What is the format needed to be sent to the socket?)

    A: Seem to be something like this:

    MT4-Ticks-To-MT5/MT4.mq4

    Lines 68 to 78 in 8934a71

    if(glbClientSocket.IsSocketConnected())
    {
    //MqlTick tick;
    //MqlRates rates[];
    //SymbolInfoTick(_Symbol,tick);
    //CopyRates(_Symbol,0,Time[0],Time[0],rates);
    string strMsg = StringFormat("quote,%s,%ld,%lf,%lf,%ld,%ld,%lf,%lf,%lf,%lf,%d,%ld,%ld,%lf,%lf,%lf,%lf,%d,%ld",_Symbol,long(TimeCurrent()),Ask,Bid,long(TimeCurrent()),
    long(Time[0]),Open[0],High[0],Low[0],Close[0],int(fabs(Ask-Bid)/Point),Volume[0]);
    //,long(rates[1].time),rates[1].open,rates[1].high,rates[1].low,rates[1].close,rates[1].spread,rates[1].tick_volume);
    //Print(strMsg);
    glbClientSocket.Send(strMsg);

_Symbol,
long(TimeCurrent()),
Ask,
Bid,
long(TimeCurrent()), 
long(Time[0]),
Open[0],
High[0],
Low[0],
Close[0],
int(fabs(Ask-Bid)/Point),
Volume[0])

Why is TimeCurrent() used twice?

  • Q: What is the intended purpose and function of the CSV files?

    1. Do they store the tick or candle data?
      A: Yes. .hst is the history files for MT4 symbols.

    2. Are they used to reload old data when starting up?
      A: Yes. Any symbol needs history. Otherwise, they will start with candle 0 and you might have to wait for the candles to get filled in your chart before your try some analysis.

  • Q: Are the CSV files created and stored in both MT4 and MT5 sides?
    A: No. Only MT4. For the history purpose.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.