This technical snippet illustrates a method for creating a button directly on a chart interface, facilitating improved user interaction. Once activated, this button executes a function designed to delete all existing orders. The process is comprehensive, accounting for diverse scenarios to ensure the function handles exceptions smoothly. Error messages are incorporated to provide immediate feedback in case of execution issues, enhancing user awareness of any operation complications. This implementation can serve as a practical model for integrating interactive components within trading platforms, demonstrating effective management of order cancellation processes.
π Read | CodeBase | @mql5dev
#MQL4 #MT4 #Script
π Read | CodeBase | @mql5dev
#MQL4 #MT4 #Script
β€27π¨βπ»2π₯1
The code provided offers the capability to configure alerts triggered upon the inception of a new bar, accompanied by a customizable sound notification. This functionality is essential for traders and developers seeking immediate updates without real-time monitoring. The implementation is designed to integrate seamlessly into existing systems, ensuring consistent notifications. Users can define specific audio cues, enhancing situational awareness during periods of significant market activity. Incorporating such an alert system enhances responsiveness and decision-making efficiency, a vital component for maintaining competitive advantages in algorithmic trading and automated strategies.
π Read | AppStore | @mql5dev
#MQL4 #MT4 #script
π Read | AppStore | @mql5dev
#MQL4 #MT4 #script
β€20π17π¨βπ»4π2
This script offers a comprehensive approach to candlestick analysis for traders. It efficiently retrieves essential data points, including opening, closing, high, and low prices. The script categorizes the candlesticks into bullish, bearish, or neutral based on the relationship between open and close prices. It performs amplitude calculations to determine differences between high and low values, and computes average amplitudes for both bullish and bearish candlesticks. The script identifies the top five significant candlesticks with the highest amplitudes in bullish and bearish categories.
A report is generated detailing the count of each candlestick type and average amplitudes, highlighting the top significant candlesticks. This report is displayed as commentary on the trading chart, providing traders with an enhanced visual understanding of the cand...
π Read | NeuroBook | @mql5dev
#MQL5 #MT5 #script
A report is generated detailing the count of each candlestick type and average amplitudes, highlighting the top significant candlesticks. This report is displayed as commentary on the trading chart, providing traders with an enhanced visual understanding of the cand...
π Read | NeuroBook | @mql5dev
#MQL5 #MT5 #script
β€33π¨βπ»7π₯1
Implementing a function to place a single order each second presents challenges such as system latency, network interruptions, and API limitations. Precision in time management is crucial to reliably execute this task. The provided code addresses these issues by guaranteeing that exactly one order executes per second and prevents multiple orders or missed seconds. The focus on maintaining time accuracy ensures consistent operation without second skips. This solution highlights the importance of handling concurrency and timing to achieve reliable automation in trading systems. Proper error handling and retry mechanisms should also be considered for enhanced robustness and fault tolerance in real-world applications.
π Read | Freelance | @mql5dev
#MQL4 #MT4 #script
π Read | Freelance | @mql5dev
#MQL4 #MT4 #script
β€14β12π4π₯3π¨βπ»3π2
The script facilitates creating nearly all standard graphical objects in MetaTrader 5, aiding in rapid visual testing of the ObjectCreate() function along with methods for setting various object properties. It focuses on attributes like coordinates, sizes, fonts, colors, and additional parameters. Upon execution, it replaces any pre-existing objects on the active chart, creating a new one based on the settings.
The script highlights the newly created object to allow for immediate adjustments of reference points or location. Users can select any standard object type using the InpObjectToCreate input parameter, including lines, channels, Gann and Fibonacci tools, Elliot waves, graphical labels, and GUI elements. Each object type has its dedicated creation function with comprehensive attribute settings such as timestamps, price levels, directions, scales, ...
π Read | AppStore | @mql5dev
#MQL5 #MT5 #script
The script highlights the newly created object to allow for immediate adjustments of reference points or location. Users can select any standard object type using the InpObjectToCreate input parameter, including lines, channels, Gann and Fibonacci tools, Elliot waves, graphical labels, and GUI elements. Each object type has its dedicated creation function with comprehensive attribute settings such as timestamps, price levels, directions, scales, ...
π Read | AppStore | @mql5dev
#MQL5 #MT5 #script
β€45π12β‘3π¨βπ»3π1π1
The script effectively compiles total profits and swaps for each currency pair, enhancing its utility for hedging strategies and accounts. It accommodates multiple entries that rely on trading signals, promoting efficient analysis of financial performance. This feature is particularly beneficial for traders who require comprehensive oversight of their trading activities and outcomes. By aggregating these metrics, the script aids in the decision-making process and improves strategic planning. This tool integrates seamlessly into trading routines, offering valuable insights into overall profitability and financial health of hedging activities. The meticulous attention to detail supports informed trading strategies.
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #script
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #script
β€25π6π¨βπ»4π2π1
A script has been developed to calculate autocorrelation and partial autocorrelation functions, displaying results graphically. Key input parameters include:
1. N: Data window for calculation, where a default value of 100 is set. Capable of handling large datasets, it efficiently processes over 100,000 bars.
2. K: Number of lags for analysis, defaulted at 16. Typically, analysis remains effective with lags under 40, though the script supports up to 500.
3. start_pos: Defines data window offset, with zero indicating calculations start from the latest loaded bar.
4. duration: Chart display period, set for 10 seconds.
These settings facilitate comprehensive time series analysis, enabling efficient examination of large datasets for technical insights. Adjust parameters according to specific analysis needs.
π Read | Calendar | @mql5dev
#MQL5 #MT5 #script
1. N: Data window for calculation, where a default value of 100 is set. Capable of handling large datasets, it efficiently processes over 100,000 bars.
2. K: Number of lags for analysis, defaulted at 16. Typically, analysis remains effective with lags under 40, though the script supports up to 500.
3. start_pos: Defines data window offset, with zero indicating calculations start from the latest loaded bar.
4. duration: Chart display period, set for 10 seconds.
These settings facilitate comprehensive time series analysis, enabling efficient examination of large datasets for technical insights. Adjust parameters according to specific analysis needs.
π Read | Calendar | @mql5dev
#MQL5 #MT5 #script
β€30π5π¨βπ»1
Recent evaluations have highlighted performance and accuracy issues with the standard API functions ChartXYToTimePrice and ChartTimePriceToXY. ChartXYToTimePrice fails to function correctly when X and Y parameters fall outside the visible chart window, defaulting to zero values. Additionally, ChartTimePriceToXY experiences inaccuracies in certain scenarios. Both functions exhibit slow performance.
To address these issues, a revised script demonstrates improved accuracy across all parameter ranges. It utilizes a method where X and Y coordinates are translated to time and price and then reverted back. Accuracy is validated if input coordinates match the output. A discrepancy indicates functional errors, notating the issue during execution. The script concludes by reporting the final outcome, remaining silent if functionality is assured.
π Read | AppStore | @mql5dev
#MQL5 #MT5 #script
To address these issues, a revised script demonstrates improved accuracy across all parameter ranges. It utilizes a method where X and Y coordinates are translated to time and price and then reverted back. Accuracy is validated if input coordinates match the output. A discrepancy indicates functional errors, notating the issue during execution. The script concludes by reporting the final outcome, remaining silent if functionality is assured.
π Read | AppStore | @mql5dev
#MQL5 #MT5 #script
β€31π2π¨βπ»1
Enhancing efficiency by cycling through Market Watch symbols with hotkeys can streamline workflow in trading environments. Utilize the Comma and Period keys for navigating to the previous and next symbols, respectively. To change the default hotkey assignments, identify the desired keycode using online resources like keycode.info. Upon accessing the site, note the keycode number for your preferred keys. Replace the existing keycodes (case 188 for Comma and case 190 for Period) with the new ones in your settings. This setup allows for quick adjustments and improved navigation through market lists, optimizing the trading experience.
π Read | AlgoBook | @mql5dev
#MQL5 #MT5 #script
π Read | AlgoBook | @mql5dev
#MQL5 #MT5 #script
β€38β‘3π3π2π2
The library initially designed for MQL5 has been adapted to function with MQL4. Users interested in this modified version can assess it by renaming the test scriptβs suffix to mq4. The adjustment process involved contributions from @fxsaber, particularly in enhancing processing efficiency. Files such as JsonTypes.mqh, JsonUtils.mqh, and JsonDomBuilder.mqh underwent modifications to bolster parsing speed. These updates aim to optimize performance while maintaining compatibility across different versions of the MetaTrader platform. Further details on the original can be accessed through the provided link to ensure thorough understanding and application.
π Read | Signals | @mql5dev
#MQL5 #MT5 #script
π Read | Signals | @mql5dev
#MQL5 #MT5 #script
β€32π7
A script is available for pulling cryptocurrency quotes from Binance and showing them in a custom symbol group inside MT5.
Enable WebRequest in Terminal Settings under Advisors and add https://api.binance.com to the allowed URLs. Copy BinanceQuotesDownloader into the terminalβs Scripts directory and run it from the Navigator.
Open View -> Symbols, then Custom -> Binance to select required instruments. Create charts via File -> New Chart -> Custom -> Binance.
Quote loading status is reported in the Experts tab. Once populated, the custom symbols can be used with indicators and standard chart analysis workflows.
π Read | NeuroBook | @mql5dev
#MQL5 #MT5 #script
Enable WebRequest in Terminal Settings under Advisors and add https://api.binance.com to the allowed URLs. Copy BinanceQuotesDownloader into the terminalβs Scripts directory and run it from the Navigator.
Open View -> Symbols, then Custom -> Binance to select required instruments. Create charts via File -> New Chart -> Custom -> Binance.
Quote loading status is reported in the Experts tab. Once populated, the custom symbols can be used with indicators and standard chart analysis workflows.
π Read | NeuroBook | @mql5dev
#MQL5 #MT5 #script
β€33π9
A simple hotkey setup can cycle through symbols in the Market Watch list.
Comma (,) selects the previous symbol. Period (.) selects the next symbol. The handler typically maps these keys to keycodes 188 and 190, often implemented as switch cases such as case 188 and case 190.
To change the defaults, look up the desired keyβs keycode and replace the numeric values in those cases. Ensure the chosen keys do not conflict with existing platform shortcuts and are consistently handled for keydown events.
π Read | VPS | @mql5dev
#MQL4 #MT4 #script
Comma (,) selects the previous symbol. Period (.) selects the next symbol. The handler typically maps these keys to keycodes 188 and 190, often implemented as switch cases such as case 188 and case 190.
To change the defaults, look up the desired keyβs keycode and replace the numeric values in those cases. Ensure the chosen keys do not conflict with existing platform shortcuts and are consistently handled for keydown events.
π Read | VPS | @mql5dev
#MQL4 #MT4 #script
β€32π3
ProjectTemplateGen.mq5 is an MT5 script utility that generates a standardized Expert Advisor project layout via MQL5 file system APIs, operating within the platform sandbox. It creates directories and writes ready-to-compile .mq5 sources with event handler skeletons, with runtime configuration through input parameters.
The implementation focuses on dynamic path construction using relative locations, comprehensive file-operation error handling with explicit error codes, and reliable cleanup via FileClose(). Output content is syntactically valid MQL5 and formatted consistently to support scaling.
Generated artifacts are placed under MQL5\Files\[ProjectName]\ due to security restrictions, requiring a manual move to MQL5\Experts\ before development continues.
Potential extensions include multi-file templates (indicators, libraries), emitting JSON/XML config file...
π Read | VPS | @mql5dev
#MQL5 #MT5 #script
The implementation focuses on dynamic path construction using relative locations, comprehensive file-operation error handling with explicit error codes, and reliable cleanup via FileClose(). Output content is syntactically valid MQL5 and formatted consistently to support scaling.
Generated artifacts are placed under MQL5\Files\[ProjectName]\ due to security restrictions, requiring a manual move to MQL5\Experts\ before development continues.
Potential extensions include multi-file templates (indicators, libraries), emitting JSON/XML config file...
π Read | VPS | @mql5dev
#MQL5 #MT5 #script
β€38π3β2
Part 39 in the MQL5 series focuses on practical file handling for trading tools. Core topics include where terminal files are stored, and safe open/read/write/close workflows for persistent logs, indicator snapshots, and error reporting.
A project script is outlined for a CSV trading journal that records account identity plus deal history fields such as ticket, symbol, type, volume, timestamps, prices, SL/TP, profit, and result, along with last update time.
User-selected storage is implemented via FileSelectDialog instead of hardcoded paths, supporting default names, filters like CSV|*.csv, and write modes that allow creating new files. FileOpen then creates or opens the target with flags such as FILE_WRITE, FILE_CSV, FILE_SHARE_READ, FILE_ANSI, followed by handle validation, error checks, and FileClose for data integrity.
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #script
A project script is outlined for a CSV trading journal that records account identity plus deal history fields such as ticket, symbol, type, volume, timestamps, prices, SL/TP, profit, and result, along with last update time.
User-selected storage is implemented via FileSelectDialog instead of hardcoded paths, supporting default names, filters like CSV|*.csv, and write modes that allow creating new files. FileOpen then creates or opens the target with flags such as FILE_WRITE, FILE_CSV, FILE_SHARE_READ, FILE_ANSI, followed by handle validation, error checks, and FileClose for data integrity.
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #script
β€19π3π2π1
Utility script for chart cleanup: removes all graphical objects from the active chart, including comments, horizontal and vertical lines, arrows, and other drawing elements.
No user input is required. Execution is immediate and will clear every object on the current chart.
Operational notes: assign a keyboard hotkey via the script context menu (βSet hotkeyβ) or run it by drag-and-drop onto the chart.
Risk notice: use on a new or non-critical chart first. Running on a working chart will permanently remove existing annotations and objects from that chart.
π Read | NeuroBook | @mql5dev
#MQL5 #MT5 #script
No user input is required. Execution is immediate and will clear every object on the current chart.
Operational notes: assign a keyboard hotkey via the script context menu (βSet hotkeyβ) or run it by drag-and-drop onto the chart.
Risk notice: use on a new or non-critical chart first. Running on a working chart will permanently remove existing annotations and objects from that chart.
π Read | NeuroBook | @mql5dev
#MQL5 #MT5 #script
β€36π2π2β‘1
A utility script is available to export all locally available tick data from the terminal into files stored under the Common directory. Existing files are appended with new ticks since the last recorded timestamp, enabling incremental updates and later reuse for building custom symbols.
Setup requires creating a destination folder in Common (default: βMW Download Historyβ) or adjusting the MW_DH_DEST_FOLDER compiler define. After compiling, add the desired instruments to Market Watch, open any chart, and attach the script.
Inputs support exporting a single symbol or all Market Watch symbols, plus selecting a timeframe (M1 recommended). Separate files are created per symbol and timeframe. Execution progress is reported in the Experts log, and periodic reruns keep datasets current.
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #script
Setup requires creating a destination folder in Common (default: βMW Download Historyβ) or adjusting the MW_DH_DEST_FOLDER compiler define. After compiling, add the desired instruments to Market Watch, open any chart, and attach the script.
Inputs support exporting a single symbol or all Market Watch symbols, plus selecting a timeframe (M1 recommended). Separate files are created per symbol and timeframe. Execution progress is reported in the Experts log, and periodic reruns keep datasets current.
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #script
β€32β4π3π2
Utility script for removing chart annotations and drawing objects on the active chart. Intended to clear items such as comments, horizontal and vertical lines, arrows, and other objects created by indicators or manual markup.
No user input is required. When executed, it deletes all objects on the current chart, so it should be validated on a clean, newly opened chart before running on an active workspace.
Operational notes: assign a keyboard hotkey via the platformβs script list (context menu: Set hotkey) or run it by dragging the script onto the chart. The code can be adjusted to keep specific object types if needed.
π Read | Signals | @mql5dev
#MQL4 #MT4 #script
No user input is required. When executed, it deletes all objects on the current chart, so it should be validated on a clean, newly opened chart before running on an active workspace.
Operational notes: assign a keyboard hotkey via the platformβs script list (context menu: Set hotkey) or run it by dragging the script onto the chart. The code can be adjusted to keep specific object types if needed.
π Read | Signals | @mql5dev
#MQL4 #MT4 #script
β€28π6
This article tackles a practical integration issue: a threaded Python socket server works fine standalone, but becomes disruptive when launched from Excel via xlwings. The root cause isnβt threading itselfβitβs blocking accept() and an always-running loop that still contends with Excelβs execution.
A safer pattern replaces blocking accept() with select() using a short timeout, letting the server poll for events without freezing the host application. Logging back into Excel is simplified with a small helper that writes status and messages into worksheet rows.
The server is then refactored into a class, separating connection checks and message handling into callable methods. Moving the main loop outside the class makes the component easier to package, test, and later adapt for MetaTrader 5 β Excel data exchange.
π Read | VPS | @mql5dev
#MQL5 #MT5 #script
A safer pattern replaces blocking accept() with select() using a short timeout, letting the server poll for events without freezing the host application. Logging back into Excel is simplified with a small helper that writes status and messages into worksheet rows.
The server is then refactored into a class, separating connection checks and message handling into callable methods. Moving the main loop outside the class makes the component easier to package, test, and later adapt for MetaTrader 5 β Excel data exchange.
π Read | VPS | @mql5dev
#MQL5 #MT5 #script
β€67π€6π5β2
NeuroPro Verbalisation Converter for MQL5 automates porting trained neural networks from the 1997 NeuroPro package into MetaTrader 4/5 code. It targets typical incompatibilities in verbalised output: missing type declarations, extra brackets, absent semicolons, nonstandard array indexes, and parsing issues where β--β is treated as a decrement operator. It also addresses ANSI CP1251 encoding, preventing Cyrillic identifiers from being corrupted.
Conversion is done by direct byte reading via FILE_BIN, avoiding clipboard-related distortions. Naming is preserved as provided in the source, including case. Substitutions are limited to required elements, such as mapping SigmoidX to SiX while keeping indices, and generating double declarations for intermediate neurons.
A bracket-balance pass trims redundant characters and normalizes line endings with semicolons. Inpu...
π Read | Docs | @mql5dev
#MQL5 #MT5 #script
Conversion is done by direct byte reading via FILE_BIN, avoiding clipboard-related distortions. Naming is preserved as provided in the source, including case. Substitutions are limited to required elements, such as mapping SigmoidX to SiX while keeping indices, and generating double declarations for intermediate neurons.
A bracket-balance pass trims redundant characters and normalizes line endings with semicolons. Inpu...
π Read | Docs | @mql5dev
#MQL5 #MT5 #script
β€24π₯4π1π1
ASQ Trading Journal Export is an MT5 script that exports full closed-trade history to a clean CSV in a single run. Trades are reconstructed from deal history with ticket, symbol, side, open/close time, volume, open/close price, SL/TP, gross P/L, swap, commission, net P/L, duration (minutes), magic number, and comment.
The output is formatted for Excel, Google Sheets, and straightforward ingestion into Python, R, or other analytics pipelines. A summary block is appended with total trades, wins, losses, win rate, gross P/L, and net P/L.
Options include date range (last N days or all history), symbol filtering, and magic-number filtering, plus toggles for swap, commission, duration, magic, and comments. The file is date-stamped and written to MQL5/Files/. Free and open-source.
π Read | Signals | @mql5dev
#MQL5 #MT5 #script
The output is formatted for Excel, Google Sheets, and straightforward ingestion into Python, R, or other analytics pipelines. A summary block is appended with total trades, wins, losses, win rate, gross P/L, and net P/L.
Options include date range (last N days or all history), symbol filtering, and magic-number filtering, plus toggles for swap, commission, duration, magic, and comments. The file is date-stamped and written to MQL5/Files/. Free and open-source.
π Read | Signals | @mql5dev
#MQL5 #MT5 #script
β€25π4π€£3β2π2