• Zelo posted an update in the group Group logo of Node.js + MQL4 DevelopmentNode.js + MQL4 Development 11 years, 4 months ago

    @Saver0, Is there any other simple way send data from MT4 to node server?
    MT4 as server and Node app is client.

    I only see Socket or ZeroMQ for now.

    • @zelo that looks really cool by the way! I have tried ZeroMQ and it worked pretty well. But i found creating a simple http server in Node.js to be the easiest and it would also be easier for anyone who want to setup your app. Because even if you use ZeroMQ or anything else, you would still need to check some sort of a queue with the way MT4 works. There is no way to get around that. So certain amount of code would always run on each start() event. If you want to completely disconnect from MT4, I would recommend getting data directly from Oanda API for example. Then there is no need for MT4 at all other than maybe to place orders :-) Let me know if you have any more questions and I will be happy to let you know what I think.

      • @Saver0, I like Node.js too. I think about send data lile ohlc and indicator data from MT4 to our app
        would be easier than connecting Oanda. I looked into your code and it pretty complicated :whistle:
        Is there any simpler way :-D

        • @zelo It shouldn’t be too complicated if you take a look at it. I may have over complicated it. Like smallcat said, it’s just that one function call that’s doing all the work. You can send the data to Node.js in any format you want. I just prefer it to be in JSON so it can be easily parsed. I send the data with a command in the first few strings so Node app knows what it should do with the data. For example, I think I used “REC:{some_json}” to indicate that I want the node app to record the data into the DB. You can do it however way you like.

          So the way I see it, for your simulator app, what it needs to do is, the Node.js app needs to connect to an EA or Indicator that accepts a certain number of commands. On each tick (or bar) the start() function will run in MT4, and EA can check with the Node.js server (APP) what it should do. If the APP needs candlestick and indicator data, as soon as MT4 ask what does it want, it would send the work request to the EA. Then on the same tick the EA would prepare the data and start sending it to the APP. It can be data that’s sent on each tick as well so the APP would have the latest data from MT4.

          I personally prefer the getting data from Oanda API approach because we can end the dependence on MT4. There are also some modules that comes with basic indicator calculations so all we would need is the candlestick data from Oanda. In a way, we wouldn’t really even need Node.js if you think about it. The whole thing can run right on the browser. Here is a very simple example that you should be able to expand on :-) https://github.com/oanda/simple-rates-panel

          • @Saver0 I know about Oanda Api. It is really good. I am biased on Oanda too.

            There is a problem with the chart app in the picture above. I can not draw trend line and get information about a candle
            because of CSS positioning, I can not get exact mouse position, LOL
            If i want to, i have to rewrite code in SVG. :wacko:

            So I will keep thing simple, keep it like the one in forum.
            I have code Trend Line, Rectangle.
            Indicator panel is next on the list.

            • @Zelo Yea, I’m biased against all Brokers to be honest.. haha just use what is available to me.
              As for the trend lines, maybe try to keep the charts simple? It doesn’t have to be 3D looking :-) If I can see 4small 600×400 windows with 4 time frame charts, on a 2×2 grid running synchronized, I would be happy :-)

      • @saver0, from the mql file we can see “if(!INet.Request(“POST”,”/”,data,false,false,req,false)) ” and “if(!INet.Request(“POST”,”/”,incoming_msg,false,true,req,false))” , the string variable “data” and “incoming_msg” are to hold the return value sent by NodeJs, and we use jsonParser to get the ‘direction’ of the signal ?

Scroll to Top