MQL5 Algo Trading
489K subscribers
3.1K photos
3.1K links
The best publications of the largest community of algotraders.

Subscribe to stay up-to-date with modern technologies and trading programs development.
Download Telegram
Creating custom indicators with candlestick charts in MQL5 involves various methods, each with distinct characteristics. The simplest approach is constructing single-color candles, neglecting highs and lows. More complex is using multicolored candles guided by defined business rules, which aids in interpreting market movements.

Building a basic candlestick chart requires defining price series for open, high, low, and close values. Utilizing buffers to store data is key, and color differentiation is tied to business logic. For example, green indicates buying, red for selling, and yellow reflects a neutral state in the market.

Using DRAW_COLOR_CANDLES allows multicolored candle plotting, adding an extra buffer for storing color data. This buffer facilitates distinguishing between bullish and bearish candles based on preset trading conditions.

If co...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #Indicator
❀62✍13πŸ‘8πŸ‘Œ5πŸ”₯3
The price channel indicator is a tool allowing customization of both the period and line colors, providing versatility in trading strategies. It is often utilized in channel break strategies, as it helps identify support and resistance levels within market trends. The ability to adjust these parameters offers traders insights into price movements and potential breakout points. This accuracy in setting channels aids in making informed decisions and enhancing strategic approaches. The price channel indicator stands as a valuable resource for traders aiming to pinpoint market entry and exit opportunities while accommodating various personal and trading preferences.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #Indicator
❀44πŸ‘3πŸ‘Œ2πŸ‘¨β€πŸ’»2πŸ”₯1πŸŽ‰1
For traders seeking efficiency, this article delves into optimizing trade execution by analyzing historic Bid/Ask spreads using MetaTrader 5's tick data. It offers a technical solution for evaluating brokers' declared versus actual spreads, particularly during volatile markets or specific trading hours. The article demonstrates how to harness OnInit() and OnCalculate() functions for strategic analysis of recent price actions. This approach empowers traders and developers to make informed decisions by understanding true cost impacts on strategies, especially in high-frequency trading. Ultimately, it highlights the importance of selecting brokers with reasonable spreads to maintain profitability.

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #Forex
❀74πŸ‘Œ4⚑3
Introducing the ZigZag Color Indicator for line charts, designed to operate on close prices instead of high and low values. This tool simplifies trend analysis by focusing on market closures, enhancing clarity in chart readings. The indicator offers a single input parameter, ExtDepth, allowing users to fine-tune the sensitivity of trend detection with minimal effort. Optimized for performance, it ensures efficient chart analysis without compromising on speed or accuracy. Ideal for traders seeking streamlined insights into market movements while maintaining system responsiveness.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Indicator
❀35⚑6πŸ‘3πŸ‘Œ2πŸ†2✍1
Understanding multi-task learning frameworks in financial market analysis reveals key advantages of using the ResNeXt architecture. This architecture employs a shared encoder to achieve robust pattern extraction across diverse tasks, enhancing generalization and resilience to noise. By reducing model overfitting through joint task training, it increases model stability in volatile markets. Computational efficiency is also improved, crucial for real-time trading systems.

ResNeXt's modularity and grouped convolutions optimize performance without significant computational cost. This flexibility supports task-specific adaptability, crucial for algorithmic trading where latency matters. Integrating multi-task learning with ResNeXt fosters robust modeling for dynamic market conditions.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #FinanceAI
❀27✍8πŸ‘Œ2
The Successful Restaurateur Algorithm (SRA) offers a unique approach to optimization by focusing on improvement rather than elimination. Unlike traditional methods, SRA enhances weaker solutions by integrating successful elements from better ones, maintaining diversity and steady improvement.

The implementation involves a main loop that selects the least successful "dish," combines it with elements from the best, and evaluates the new solutions. Parameters like temperature and innovation rate control experimentation intensity, balancing exploration and refinement.

Tests show SRA's broad search capabilities but highlight its challenges in precise solution refinement, ranking it 20th among population optimization algorithms. Despite mixed results, SRA's distinctive strategy provides valuable insights for future algorithm development.

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #Algorithm
❀64πŸ”₯7πŸ†6⚑5🀨5πŸ‘€3✍2
Discover momentum deviation bands, an indicator akin to Bollinger bands. This tool assists in analyzing market momentum shifts. Use it as you would Bollinger bands to assess price volatility and potential breakouts. It offers insight into market behavior by tracking deviations from a moving average. This can aid in identifying trading opportunities and gauging market conditions. Employ momentum deviation bands to enhance technical analysis and refine trading strategies. Suitable for those seeking to expand their toolkit with a method focused on interpreting price movement dynamics.

πŸ‘‰ Read | Docs | @mql5dev

#MQL4 #MT4 #Indicator
❀37✍5πŸ‘Œ2
Discover how to create a Mini Chat in MetaTrader 5 with sockets! In this article, explore integrating a chat system using sockets without the need for DLLs. Learn to separate client-server architecture, with clients in MQL5 and an external program as the server. This showcases the adaptability of sockets and offers a practical example of embedding them in a trading platform via an Expert Advisor. The demonstration includes managing connections dynamically and using a circular buffer for messages. Whether you're enhancing trading tools or experimenting with new features, this guide offers valuable insights into integrating interactive elements within MT5.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #Sockets
❀33πŸ‘Œ1
Testing Non-Random Market Behavior with MQL5

The concepts of market randomness and predictability form the core of trading strategies. This discussion focuses on Larry Williams’ approach to determining whether markets display non-random behaviors. By utilizing MQL5, experiments are designed to test if certain price patterns appear more often than chance would suggest.

Experiments cover three main areas: overall directional bias within a single candle, conditional probability patterns after sequential candles, and short-term market structures like Williams’ three-bar pattern. Each experiment uses an algorithmic approach to scan historical data and calculate probabilities.

The MQL5 Expert Advisor is crafted to assess the probability of repeated patterns, simulating real trading conditions by opening and closing positions at candle boundaries. This allo...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #Trading
πŸ‘16❀13✍4πŸ‘Œ3
Explore an advanced AI-powered trading system in MQL5 with enhanced UI features. This includes loading animations for smoother interactions during API requests, precision in response timing, and intuitive response management tools like regenerate and export buttons. The implementation focuses on scalable, modular code, using clear rendering techniques for icons and dynamic updates without affecting core functionalities. Practical for developers, the upgrades facilitate better user engagement and streamlined trading operations. Future enhancements will include sentiment analysis and multi-timeframe signal confirmations for more informed trading decisions.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AITrading
❀29⚑7✍3πŸ‘2πŸ‘€2πŸ‘Œ1
Part 33 of the MQL5 series delves into integrating the Google Generative AI API with MetaTrader 5. This tutorial covers sending text-based queries, receiving intelligent responses, and managing API limits like queries per minute, requests per day, and tokens per minute.

Understanding rate limits in API usage is crucial. Requests per Minute (RPM) limit the number of API calls in a minute. Requests per Day (RPD) constrain daily interactions, while Tokens per Minute (TPM) track the computational cost per request. Strategies to optimize usage and maintain smooth performance include request bundling and response caching.

Generating an API key is essential before using the API. The key identifies your application and controls access, ensuring secure interaction with Google's servers.

Enable WebRequest in MetaTrader 5 by adding the API URL to the settings, allowing y...

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #AI
❀58✍10🀯2πŸ‘Œ1
A lightweight script estimates an exponent (power) factor that measures how closely historical price increments match random-walk scaling. Under the theoretical random walk, displacement grows with the square root of steps, corresponding to an exponent of 0.5. Real market data typically deviates due to non-normal increments and regime effects.

The estimated factor can be used to rescale increments toward a more uniform distribution, improving stability of volatility-sensitive processing in automated trading systems. It also supports instrument classification by β€œrandom-walkness” with a single computed value.

Interpretation is straightforward: values near 0.5 or below often align with lower volatility and range behavior, while values above 0.5 indicate higher volatility and heavier tails. In practice this tends to separate mean-reversion candidates fr...

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #Indicator
❀20✍5πŸ‘4🀯1πŸ‘Œ1πŸ‘€1
An MQL5 library brings ARCH/GARCH-style volatility modeling into MetaTrader 5 with a clean, composable design: conditional mean, volatility process, and residual distribution are separate components but estimated jointly through the mean-model interface.

Model setup is driven by a single ArchParameters struct that captures the time series, optional exogenous inputs, AR/HAR lag configuration (including non-overlapping HAR windows), volatility family selection, distribution choice (Normal, t, skew-t, GED), scaling checks, and GARCH p/o/q plus power.

Fitting minimizes log-likelihood using ALGLIB’s constrained optimizer, returning an ArchModelResult with parameters, covariance, residuals, in-sample conditional volatility, and diagnostics (t-stats, p-values, adjusted RΒ², standard errors).

Forecasting supports analytic, Monte Carlo simulation, and bootstra...

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀34πŸ‘Œ4
Larry Williams’ short-term swing points are turned from a chart concept into a testable MT5 system by encoding a strict three-bar pivot rule and structural filters. A swing low/high is confirmed only after bar close, using bars 1–3, with the middle bar as the candidate extreme.

Signal quality is improved by excluding pivots formed by outside bars (engulfing volatility) and setups involving inside bars (contraction/indecision). This keeps the EA focused on clearer exhaustion points.

The MQL5 Expert Advisor is designed for research: configurable trade direction, fixed or percent-risk sizing, exits by next-bar close or risk-reward take profit, and stop loss anchored to the swing bar extreme. Logic runs once per new bar, with modular functions for detection, validation, risk, and execution.

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #EA
❀34✍4πŸ‘Œ2
Neuroboids Optimization Algorithm (NOA) reframes population-based optimization as many tiny neural agents. Each β€œneuroboid” is a minimal two-layer network trained with Adam, using the current best candidate as a moving target rather than hard-coded swarm rules.

The loop is straightforward: random initialization, per-agent forward pass to propose a step, error vs. the best solution, backprop updates, then position updates with scaling to [-1, 1] and bounded resampling. A small elite-copy probability adds controlled exploitation while preserving diversity.

In benchmark tests (Hilly, Forest, Megacity), NOA reached about 45% of the maximum aggregated score for small to moderate dimensions, but becomes too slow at very high dimensionality (e.g., 1000 variables). Visual runs show fan-like movement patterns that reflect learned search directions across age...

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #algorithm
❀25πŸ‘6πŸ‘Œ2πŸ”₯1
Sigma Score is an MT5 indicator that standardizes the latest bar’s log return into a z-score, showing how many standard deviations it deviates from the recent mean. Values near zero reflect typical noise; readings beyond configurable bands (commonly Β±2) flag statistically unusual moves, with the caveat that real returns have heavier tails than a normal model.

The implementation focuses on practical MT5 engineering: one plot buffer, level lines at 0 and thresholds, and a rolling calculation in OnCalculate using prev_calculated for efficiency. It computes mean and variance inline (no extra arrays), skips invalid prices, uses EMPTY_VALUE for non-computable regions, and adds a small stdev guard to prevent divide-by-zero artifacts.

Traders can use extremes as context for mean reversion or momentum decisions, and as a risk meter when volatility regimes shift.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #Indicator
❀62πŸ‘5πŸŽ‰5😁3✍2πŸ€”2πŸ‘Œ1
TelegramTradeNotify is a lightweight MT5 utility EA that pushes trade execution notifications to Telegram via the Bot API sendMessage endpoint.

Alerts are triggered on executed deals (TRADE_TRANSACTION_DEAL_ADD), with an optional BUY/SELL-only filter. Message formatting includes UTF-8 URL encoding for non-ASCII text, plus an option to disable link previews. Configuration is limited to bot token, chat ID, timeout, and a prefix.

Setup requires creating a Telegram bot and obtaining its token, then selecting a target chat ID, group ID, or @channelusername. In MT5, enable WebRequest for https://api.telegram.org under Tools β†’ Options β†’ Expert Advisors, then attach the EA to any chart and set InpBotToken and InpChatId.

If WebRequest fails, verify firewall/DNS rules and MT5 allowed URLs. Some VPS networks block Telegram traffic; a different route or relay may be r...

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #EA
❀29πŸ”₯6πŸ‘Œ2
Multivariate time series modeling remains constrained by multi-scale dependencies, nonlinear cross-variable interactions, preprocessing overhead, and long-sequence compute cost. Transformer attention scales poorly, while classical statistical models require heavy feature engineering and struggle with nonlinear structure.

Chimera proposes a 2D state space model applying linear transforms across both time and feature axes, with cross-dimensional transitions. Compact parameterization and adaptive discretization target seasonality, trends, and dynamic interactions, supporting forecasting, classification, and anomaly detection with lower compute.

An implementation path in MQL5 replaces diagonal A-matrices with fully trainable tensors, generates B/C/Ξ” from input context, and offloads 2D-SSM forward/backward passes to OpenCL kernels for GPU-parallel execution.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀27πŸ‘Œ3✍2
Large-scale Forex testing (100k+ moves) revisits Fibonacci beyond classic retracements by measuring both price ratios and time ratios between pivot points, with statistical validation instead of visual chart fitting.

A Python + MetaTrader 5 pipeline generates Fibonacci ratios, extracts β€œsignificant” swings via noise filtering and reversal/threshold logic, then matches adjacent-move relationships using tolerance bands rather than exact values.

Results show frequent clustering near 0.618/0.382/0.236 in price, plus non-random Fibonacci-like durations (e.g., 2–3–5 hours). The strongest signal is β€œtime resonance”: price and time ratios aligning at the same pivot, lifting forecast confidence to ~85–90% and delivering ~72% hit rate on high-probability setups across pairs and timeframes.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AlgoTrading
❀34🀯4πŸ‘Œ4
Part 4 extends an MQL5 indicator series with a Smart WaveTrend Crossover: two WaveTrend oscillators are used, one tuned for signal crossovers and one tuned for higher-level trend filtering.

The signal logic is based on crossovers between a fast and a smoothed WaveTrend line. Optional confirmation requires the crossover direction to match the trend oscillator state, reducing counter-trend alerts.

Implementation details include 23 buffers and 3 plots: DRAW_COLOR_CANDLES for trend-colored bars, plus DRAW_ARROW plots for buy/sell markers. Inputs cover channel/average/MA lengths for both oscillators, trend filter enablement, candle coloring, arrow colors, and point-based offset placement.

OnCalculate initializes buffers on first run, computes both oscillators per bar via a manual EMA helper, flags crossovers, applies trend state, and renders arrows accor...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Indicator
❀21πŸ”₯4πŸ‘Œ4✍2
Part 34 extends the WebRequest-to-Generative-AI work by adding an on-chart control panel, so prompts can be typed, sent, and responses viewed without leaving MetaTrader 5.

The article uses the Dialog control framework: include the Dialog library, create a global CAppDialog container, then build the panel with a chart ID, unique name, window index, pixel offsets, and size. Calling Run() is required for the panel to process user interactions.

It also covers lifecycle safety. On recompiles or timeframe changes, the EA reloads and the panel must be explicitly cleaned up via Destroy() in OnDeinit to prevent instability.

User input is captured with an editable text control: include the edit control header, create the input field, set dimensions, and attach it to the dialog so backend API code can consume the typed prompt.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #AI
❀35πŸ‘7πŸ”₯3✍2πŸ‘Œ2