Download Sudoku for MetaTrader 5

Sudoku

Sudoku

This is a powerful addition to your MetaTrader 5 toolkit designed to optimize market analysis and performance. This Expert Advisor serves as automated trading software. It is utilized to monitor financial markets and execute trades based on predefined algorithmic rules, enabling precise position management without the need for constant manual oversight.

MT5 expert Pack 📂

How to Setup and Use Sudoku

1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.

2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.

3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.

4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.

Frequently Asked Questions

Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.

Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.

Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.

Description & Settings


Did you ever want to pass the time or to stretch your brains while awaiting important news event or monitoring open position in MetaTrader? It's easy with . This nontrading expert can do many things for Sudoku: generate boards, load existing boards, check difficulty, let you play and solve Sudokus right in MetaTrader chart. This is the classical 9x9 Sudoku with 9 blocks, and digits from 1 to 9 to fill empty cells.
After its started the program shows a dialog with a puzzle. If input parameters are left default, this is a special introductory position provided with the source codes (you may find some details below).
You can adjust input parameters to get random sudokus with different characteristics. Please, note, that new board is not generated right after the start, but upon clicking the New button in the dialog. Other buttons are available in the dialog: Hint shows automatically calculated candidates for empty cells (normally, a fair player should deduce candidates himself/herself, but this option helps you learn Sudoku a bit, if you're a novice); Undo reverts performed moves/changes on the board.
Input parameters

Sudoku - name of a file with Sudoku position; this is a text file with 81 symbols, where every digit from 1 to 9 is a clue, and other symbols (presumably, 0s or dots) denote empty cells at corresponding places; for better visibility the single long line can be splitted into 9 separate lines with 9 symbols in each, which resembles the board as is (please find an example below);

ShufflingRandomSeed - an integer number to initialize random generator during board shuffling; default value -1 means randomization by timer - every time you hit New, you'll get a unique position (completed board which is not shown to the player); if you specify any other specific number, you'll always get the same completed board; if you change the number you'll get another reproducable board, etc;

CompositionRandomSeed - an integer number to initialize random generator during selection of clues from the completed position; the clues are the numbers and their cells which will be presented to the player; default value -1 means randomization by timer - every time you hit New, you'll get new clues (yet you can do it on the same completed board, if specific ShufflingRandomSeed is given); if a value other than -1 is used, you'll always get the same set of clues (for the same board), but if you change shuffling, the clues will change as well of course;

ShufflingCycles - number of cycles of shuffling; every cycle performes special permutations, starting from initial trivial board; default value is 100;

EliminateLabel - a number to eliminate from possible clues; default value 0 means that every number from 1 to 9 can appear in clues; if a number from 1 to 9 is selected, it will not appear in clues (this can be considered as an additional complication);

Auto-Assistant - an option to enable/disable special help mode: if it's enabled, entering a label to a cell will clean up the same candidates in all cells of corresponding row, column, and block; also if a wrong label is provided (which conflicts with existing labels), the problematic structures (row, column, block) will be highlighted in yellow;
Here is an example of log when you generate new sudoku:
The last line mentions the name of file with the new board. You can use it in the input parameter Sudoku to continue the same puzzle next time (in the next MetaTrader session). For every puzzle, the program remembers current position in a special file (with the same name as Sudoku, but with additional extension ".log"). Also all edits on the board is logged in the global variables and can be reverted by Undo button.
The number of clues and estimated difficulty are also shown in a comment on the chart. There is no a standard scale of Sudoku difficulties, so you'll get accustomed with suggested rating after some time. The value below 2 means easy level, 2 and a bit higher - medium level, above 3 - difficult, it requires to speculate/make guesses multiple times, and backtrack in case of wrong guessing (encountering a collision). Unfortunately it's not possible to generate sudoku of specific difficulty upon request. If you get a puzzle with undesirable difficulty, try to generate another random one.
You can enter a single digit in a cell (fill the edit field), or mark it with several digits - so called candidates, possible values. Candidates are displayed in smaller font in green. During the play you should eliminate candidates one by one and finaly left a single digit (displayed in blue).
Be cautious: clicking the Hint button will overwrite your manually entered candidates (if any). Clicking the Hint button second time will hide candidates completely. In other words, the Hint button works as a switch for automatic help.
The program will check if the puzzle is solved only when all cells are filled with single digits. Of course, the board is considered solved if it complies with Sudoku rules.
The introductory sudoku supplied with the program and shown by default is interesting in many aspects.

it consists of 17 clues, which is minimal possible number;

it's relatively easy, because it can be solved in straightforward manner without speculations;

yet it requires many different (and not so obvious) methods of logic reasoning to make moves;
Here is how the puzzle is presented in the text file:
It could be as well
or
.
To build the program, unpack the attached res.zip with bmp-resources (it should create MQL5\Include\Sudoku\Layouts\res\ folder with bmp-files), and then comment out the line #define CODEBASE_CHECKUP in the source code SudokuUI.mq5. Without this some button images will be unavailable. This is a workaround for the strange limitation of the codebase, which does not allow BMP-files, which are mainly used for graphic resources in MQL.

You May Also Like

RobotFX does not own any of the code provided on this platform. All tools are freely available on the internet; we simply index and re-offer them for download. We are not responsible for any financial losses that may occur. Trading responsibilities rely solely on the traders downloading and using the displayed Expert Advisors, indicators, and scripts. These tools are provided for educational purposes only and may require modification or optimization to align with a trader's specific strategy or needs.
© ROBOTFX - Best MetaTrader Expert Advisors & Indicators