The Python route, in one filetv-mt5-listener.py
A single Python file that runs on your Windows VPS next to MetaTrader 5. It does the nine jobs listed at the end of Chapter 8: receives the alert, checks the secret, reads the message, maps the symbol, checks the fences from your risk sheet against the live account, sizes the trade from the live balance (rounded down, skip if zero), closes an opposite position on a reverse, sends the order with stop and target, and logs every decision. Optional Telegram messages and a maximum message age so a late alert is dropped, not placed.
- · Setup steps are at the top of the file. About ten minutes on a VPS that already has MT5.
- · Edit one block: secret, symbol map, the five fences, magic number.
- · Run it on demo and put it through all 22 tests in Chapter 11 before real money.
- · MIT licence. Read it, change it, keep a copy.