GithubHelp home page GithubHelp logo

peterszombati / metatrader4 Goto Github PK

View Code? Open in Web Editor NEW
23.0 5.0 11.0 410 KB

This module is make connection between NodeJS and MetaTrader4

License: Other

TypeScript 35.75% MQL4 64.25%
metatrader4 nodejs trading forex trading-api mql4

metatrader4's Introduction

Connection between MetaTrader4 and NodeJS

Sources

#1 https://github.com/dingmaotu/mql4-lib

#2 https://github.com/dingmaotu/mql-zmq

1. Compile MetaTrader4Bridge.mq4

  1. Download https://github.com/dingmaotu/mql4-lib/archive/master.zip
  2. Unzip to: <MetaTrader Data>\MQL4\Include\Mql\<mql4-lib content>
  3. Download https://github.com/dingmaotu/mql-zmq/archive/master.zip
  4. Unzip to: <MetaTrader Data>\MQL4\<mql-zmq content>
  5. Move from: <MetaTrader Data>\MQL4\Library\MT4\<content> to <MetaTrader Data>\MQL4\Libraries\<content>
  6. Delete: <MetaTrader Data>\MQL4\Library
  7. Download https://raw.githubusercontent.com/peterszombati/metatrader4/master/src/MetaTrader4Bridge.mq4
  8. Move to: <MetaTrader Data>\MQL4\Experts\MetaTrader4Bridge.mq4
  9. Compile MetaTrader4Bridge.mq4 expert

Example usage

import MetaTrader4 from "metatrader4";

const mt4 = new MetaTrader4({
	apiKey: "CHANGEME",
	reqUrl: "tcp://127.0.0.1:5555",
	pullUrl: "tcp://127.0.0.1:5556"
});

mt4.onConnect(() => {
	console.log("Connected");
	mt4.getAccountInfo().then((account) => {
		console.log(account);
	});
	mt4.getLastCandles("EURUSD").then((candles) => {
		console.log(candles);
	});
});

mt4.connect();

node-mt4-zmq-bridge project has deficiency

This project has deficiency: https://github.com/bonnevoyager/node-mt4-zmq-bridge so I developed it and published this new repository.

metatrader4's People

Contributors

dawadam avatar peterszombati avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

metatrader4's Issues

Example usage

Hi,

Please provide examples of using subscription methods.

Keep getting this

const mt4 = new MetaTrader4({
^

TypeError: MetaTrader4 is not a constructor

im using .js file and this kind of thing keep showing when i want to start node index.js

How do I get the apiKey, reqUrl and pullUrl ?

I'm trying to make a nodeJS server communicate with MT4 and make transactions from the server. I'm using metatrader4 with teletrade.eu as a broker. Now where do I get the API key and other details?

I tried to use https://www.metatrader4.com/en/brokers/api but not only I can only get an Metatrader 5 API key but I also need to have a company and request access to API as if I was a broker.

Is there any other way to make transactions from the server on my personal account?

const mt4 = new MetaTrader4({
apiKey: "CHANGEME",
reqUrl: "tcp://127.0.0.1:5555",
pullUrl: "tcp://127.0.0.1:5556"
});

METATRADER4 cannot connect with tcp://127.0.0.1:5555

METATRADER4 cannot connect with tcp://127.0.0.1:5555
METATRADER4 cannot connect with tcp://127.0.0.1:5556

i have meta trader running ive imported the mql file to expert advisor, the api key on both sides and all libs, but when connecting this always happen, do i need to open a tcp port?

Can this be used for reading alerts from custom dashboard indicator

I have a custom dashboard type indicator that scans around 10 pairs with multi time frame and alerts via a pop up and
push notification, I want to catch those alerts and use them for auto trading or sending them as signals can you please give an example for reading the alerts from 3rd party indicators

import MetaTrader4 from "metatrader4";

Hi,
I tried your given example.
However I am getting error

import MetaTrader4 from "metatrader4";
^^^^^^
SyntaxError: Cannot use import statement outside a module

How can I fix this one?

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.