Discussing the article: "MQL5 Wizard Techniques you should know (Part 97): Using Convex Hull and a miniature GRU Network in a Custom Trailing Stop Class"

 

Check out the new article: MQL5 Wizard Techniques you should know (Part 97): Using Convex Hull and a miniature GRU Network in a Custom Trailing Stop Class.

For this article we look at a custom MQL5 Wizard class for Trailing Stops. Our implemented custom class ‘CTrailingConvexHullGRU’, is built from merging the Convex Hull algorithm with a GRU network. As always we seek to develop a model that is testable with MQL5 Wizard-Assembled Expert Advisors and can be tuned with various Money Management and entry Signals classes. Our testing is with the 'Envelopes' and the RSI classes for Signal.

We resume this series on the MQL5 Wizard where we rotate our focus between entry signals, money management and trailing stops. These three domains are the main ways Expert Advisors assembled with the MQL5 Wizard, can be customized beyond the built-in classes. For the last published articles we have looked at entry signals and then money management which means that trailing stops are our focus for this article. In the last piece on trailing stops we married the Reservoir Sampling algorithm with a linear regression network to build a model whose goal was hugging a 'fair median' price. This was meant to guard open-positions from sideways chop.

This approach can work well in choppy markets but in trending markets it would be strained, marginally at least. Today therefore we venture into 'trading the median for the perimeter". We introduce a trailing stop class that is run by the Convex Hull algorithm - logic that is purposeful in defining an "outer-shell" of price action and we pair this as always with a neural network, with the choice for this article being a simplified Gated Recurrent Unit (GRU). The network serves as a momentum filter.

This addition to the MQL5 library arsenal, as always, is not a silver bullet but rather an alternative approach for momentum traders to ride explosive breakouts. When in tight ranges of price action it is bound to struggle which is why the adopting trader needs to be one with the discipline/ specialty in handling breakout momentum setups.

Author: Stephen Njuki