Deep Learning, AI, Neural networks in SQ4

11 replies

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

3 years ago #233156

I’d like to open a discussion about this, what and how exactly to integrate it / use it with SQ4.

Our current plan is to develop a custom Neural Network module that will be able to train NN to produce trading signals.
How it will work from users point of view:

  1. User configures inputs – list of signals/indicators to be used in NN, some NN properties, backtest data etc.
  2. SQ4 will train NN on the historical data using genetic evolution
  3. The result will be a strategy with complete source code that uses TRAINED Neural Network that produce signals to buy/sell/hold/exit. The strategy can be used in Mt4 or other trading platform

We have it about 50% ready, it should be quite simple to use.


I’m open to discussion about what are your expectations about Deep Learning, and your idea of how it should work with SQ4.

Our implementation described above is a “fixed” solution with not many customizations possible. We are not against integrating SQ with TensorFlow or similar solution, to provide more flexibility to the deep learning process.

We should just determine how to integrate it – what should be done on SQ part to make it work and be as flexible as possible.



StrategyQuant architect



Customer, bbp_participant, community, 27 replies.

Visit profile

3 years ago #233195

Hello Mark,

This is a very good topic. I want share my experience about NN.

Last year I implement a supervised multi layer perceptron in mql4 with error backpropagation learning method. My inputs is the last X bars highs, lows and closes prices plus another price indicator like moving averages. So, for example, each new bar, the EA gets the last 10 bars highs, lows and closes prices as input for NN. The expected result will be 1 if the future price reach TP (+2 ATR from the last open price) and -1 if the future price reach the ST (-2 ATR from the last open price) .

The NN run for each bar and I tested for long period but the final result is that the NN didn´t train and don´t have any edge.

After some research, I discovered that the NN won´t train due the market has multiple patterns or candle patterns and, in this model that I built, I was presenting multiples patterns for NN and it is the why NN was not training. Because each pattern has your edge. The ideal world, is present only one pattern for each NN and try to train this specific pattern.

So we first must classify similar patterns and input one specific pattern to NN and see if it could be trained.

So, I find a new approach to implement and I´m working on it for now. First task, is a clustering similar patterns. I found a good algorithm called BIRCH clustering (balanced iterative reducing and clustering using hierarchies) for classify patterns. With BIRCH clustering, I can filter similar patterns like the graph attached.

As we can see, each rectangle box is a specific pattern and I think that is the best way to implement NN.

After we have classified the patterns, we presented to a NN and see if could train this specific pattern.



You must be logged in to view attached files.



Customer, bbp_participant, community, 15 replies.

Visit profile

3 years ago #233221

Tensorflow would be interesting or one of the variations of .i.e Tensorflow Lite or Keras. Would much rather see an integration other Python packages like  scikit-learn. Random Forest and Ensembles methods I think would work well with GP. Pymc3 for Bayesian modeling would be a nice addition (for version 5 or 6 :))

Any discussion on what the upgrade path pricing for version 3 to 4 yet or is that more of a – wait and see for now?




Subscriber, bbp_participant, community, 0 replies.

Visit profile

3 years ago #233481

I think with current state of so called AI it is better to integrate it into strategy finding process rather than trading decision making.

I have not seen any proof of machine learning, deep learning etc to make any profit on real accounts.



Customer, bbp_participant, community, 0 replies.

Visit profile

3 years ago #233629

Hi Mark,
I recently found this EA Generator from BJF ( which it appears is just the Hlaiman ( product repackaged for a much higher price…
There’s a demo EA and Indicator on, as well as some articles by the creator about it usage:!keyword=hlaiman
Here’s their documentation:

I noticed theres also quite a few articles covering Neural topics on there:!keyword=neural

Probably a better use of time than just rolling dice…  😉

... the alien does not concern itself with the opinions of humans ...



Subscriber, bbp_participant, community, 0 replies.

Visit profile

3 years ago #235124

why do you think that DL in SQ4 would not work. What AI experience do you have. It all depends on how and what algorithms you use to implement your architecture. AI in itself requires an depth knowledge of what you are actually doing and what you want to accomplish.

Simply throwing together some half-baked AI algorithms ( usually supervised shallow algorithms ) to solve the Trading domain issue is a novice idea.

AI works if you have the right knowledge and use it correctly otherwise its like firing a machine gun while blind folded and hoping to hit your target.




Customer, bbp_participant, community, sq-ultimate, 19 replies.

Visit profile

3 years ago #234129

Hi Mark,

Have you considered ENCOG Machine Learning? It has JAVA library with it (look at this link –
Since SQ is also JAVA based, perhaps the two can blend and complement each other better than Phyton, or other packages.
ENCOG has been there for many years and proven very stable and fast. As for time series, it has RNN.





Customer, bbp_participant, community, sq-ultimate, contributor, author, editor, 266 replies.

Visit profile

3 years ago #235145

notch 😀 😀 😀 😉



Customer, bbp_participant, community, 878 replies.

Visit profile

3 years ago #235350

My view is that effort is better spent on getting SQ4 to be totally reliable and bug free as it is.

NN and other non-linear ML techniques will just add more curve fitting in many cases.



Customer, bbp_participant, community, 4 replies.

Visit profile

3 years ago #235364

This is a great idea and a conversation. I would love to see how the implementation of this module will work with SQ4, the utilization and UI of MS Azure ML is something to look into.



Subscriber, bbp_participant, customer, community, 45 replies.

Visit profile

9 months ago #268795

Has this progressed in the last couple of years?


Aram Mohammed

Subscriber, bbp_participant, customer, community, sq-ultimate, 4 replies.

Visit profile

1 month ago #274233

I am very curious to see this feature implemented in SQX. Has there any progress happening for this feature lately?


Viewing 12 posts - 1 through 12 (of 12 total)