Trading robot for forex or stock

Recently I am thinking to make a trading robot by Node-Red, surprisingly I can only find very limited information except cryptocurrency trading robot. It seems Node-Red developers are only interested in cryptocurrency but not forex or stock trading.

Anyone can share some lights on forex or stock trading robot by Node-Red? I don't know MQL4 or MQL5 and don't see any nodes about them. So my initial thinking is using Node-Red with Python (more APIs and libraries).

The robot should be able to do some analysis, best by AI or ML, and place orders. Any idea?

2 Likes

The reasons you probably can't find anything are:

  • If someone had something clever, they would be keeping it to themselves or selling it to someone. This is a very lucrative market.

  • Trading is generally a millisecond sensitive task with the big traders moving their compute facilities as close to international Internet hubs as possible in order to shave a few ms off trading times. Node.js is not a very good tool for this job, trading tools are written in fast compiled languages for the same reason as above. In addition Node.js is single-threaded which means that what performance it does have can be rather variable depending on many factors.

So all the info you find on MQL4/5 is focused on C/C++ not on Node.js - Node-RED of course is built on Node.js.

NR is a wonderful, general purpose, compute tool for rapid, low-code development. It is not designed for high-performance systems.

Still, it would be very nice for learning purposes if somebody created some flows and etc. so we understand what exactly is a trading bot.

In my current limited knowledge about the topic, my theory is that we are all engineers or maker minded people here and we dont pursue / believe in easy money making opportunities :slight_smile: even node red itself is free. Or did nick find a way to grow money on trees so that he can spend all his time on nodered :slight_smile:

If your investment horizon is day trading with real time data or if you hope to earn on the spread between different stock exchanges, I guess you cannot compete with the robots. As @TotallyInformation mentioned, shaving off microseconds becomes important. I know the shorter optical fiber connection you want to the trading system, the higher cost!

I think for "longer term" investments, using technical indicators could work "as a guide" when you should sell or buy. But it is very difficult to build a model that covers all market situations and for all kind of stocks. I would like to see a model based on neural network where the algorithms adopts themselves for each selected stock, maybe that would be something! In addition historical price analysis has to be combined with a fundamental analyse. How many times have we not seen how the stock price was changed rapidly & surprisingly due to a good or bad newsticker!

Once you have the model in operation, you need one more thing; a huge data set with historical data that you must be able to use in a simulation mode, running through and testing your model if it would have made a profit or loss and how much

Totally agree with you especially the millisecond sensitive stuff. My tools are quite limited, I only know Node-Red, Python and KNIME. Node-Red is rapid in development and flexible enough to test for prototype, and I am planning to use Node-Red at a higher level to run some Python codes and grasp analysis from KNIME. It would be an incentive enough as a trial to put Node-Red/ Python/ KNIME together.

Even better if Node-Red already has some nodes in trading robot.

I still believe a neural network based robot would be a thing to experiment with
https://towardsdatascience.com/predicting-stock-prices-using-a-keras-lstm-model-4225457f0233

Back in 1999-2000 me and a friend actually developed a robot for our personal usage. It was able to analyze & trade fully automatically with a midterm model approach. It used familiar well known technical analysis indicators. We had years of historic intraday data for the simulation mode we could run through to test the model. The big problem, our experience, was that all stocks had such unique pattern they needed individual parameter settings that also should change in time to maximize profit. So we ended up in a conclusion that parameters would have to be dynamically updated in some way "by learning". That part we never managed to implement. The "robot" was running a few years, it did not make a huge success, it traded ok and at the end of it's lifetime had made a small profit. After a few years we then had to turn it off, we got complaints polling the providers server too heavily for intraday data so there it reached the end of our excersize. Was funny and I think I learned a lot. If I would start a new project today, I would not do it without the "by learning" ingredient. Therefore neural network sounds to me as an interesting path to investigate & maybe follow

1 Like

think for "longer term" investments, using technical indicators could work "as a guide" when you should sell or buy.

There are free api's that actually give these indicators (ie: pattern recognition like Double Bottom, Bat, Head and shoulders, over a sliding window timeframe, pretty awesome), and buy/sell signals. finnhub is a nice one, they have these indicators for both stock and crypto. They also provide websockets for realtime price updates (not for the indicators).

But as @TotallyInformation says, if you want to do it in micro-world, you will always be too late, it is the reason why daytrader firms are located next to the exchange, although they are required to have a certain minimum cable length (!) to enforce some latency for a "more" equal playing field.

But let's assume you are not highfrequency daytrader, this should be possible with node-red as long as you have API's you can interact with.

I created my crypto portfolio with node-red and uibuilder to pull realtime data from the exchanges, but don't use it for buy/sell orders (yet), but this could be very well possible as it is no different than getting the data other than some put/post requests.

1 Like

If you "dry-run" your solution or if you manually check the historical buy/sell signals, you could easily see if an automatic trading would have been successful or not

1 Like

Testflows are in progress :wink:

I have almost finished the back end stock analytic part by KNIME, now looking for a trading robot to inquire prices and place orders.

Still thinking about Node-Red to execute orders as Node-Red is easier to build chatbot and dashboard to visualise and communicate with myself via mobile phone.

Check with Interactive Brokers but they only support Python (I don't know java, C++, etc), not quite native to work with Node-Red. But IB supports most type of assets and markets.

Any suggested brokers that support Node-Red with variety of assets and markets like IB?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.