Recording a session for self-review without uploading
Re: Recording a session for self-review without uploading
Here is the complete MQL5 Expert Advisor. It listens for any trade execution (opening or closing a position) on the chart it is attached to, waits half a second for the platform to draw the entry/exit arrows, and automatically saves a high-resolution screenshot.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Recording a session for self-review without uploading
The MQL5 Code
Code: Select all
//+------------------------------------------------------------------+
//| AutoScreenshot.mq5 |
//| Auto-Journaling utility |
//+------------------------------------------------------------------+
#property copyright "Auto-Journal"
#property link ""
#property version "1.00"
//--- Input Parameters
input int InpWidth = 1920; // Screenshot Width (pixels)
input int InpHeight = 1080; // Screenshot Height (pixels)
input string InpFolderName = "Trade_Screenshots"; // Save Folder Name
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
Print("Auto Screenshot EA initialized. Files will save to MQL5/Files/", InpFolderName);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| TradeTransaction function |
//| Triggers automatically whenever a trade event occurs |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
const MqlTradeRequest& request,
const MqlTradeResult& result)
{
// We only trigger when a new deal is successfully added to the history
if(trans.type == TRADE_TRANSACTION_DEAL_ADD)
{
// Ensure the trade belongs to the symbol of the chart the EA is running on
if(trans.symbol == _Symbol)
{
TakeScreenshot(trans.deal);
}
}
}
//+------------------------------------------------------------------+
//| Core Screenshot Logic |
//+------------------------------------------------------------------+
void TakeScreenshot(ulong deal_ticket)
{
// Wait 500ms to allow MetaTrader to draw the red/blue trade arrows on the chart
Sleep(500);
// Format the current time for the filename (avoiding illegal characters)
datetime time = TimeCurrent();
string timeStr = TimeToString(time, TIME_DATE|TIME_MINUTES|TIME_SECONDS);
StringReplace(timeStr, ".", "-");
StringReplace(timeStr, ":", "-");
StringReplace(timeStr, " ", "_");
// Determine if the deal was an Entry (Open) or Exit (Close)
string actionType = "Trade";
if(HistoryDealSelect(deal_ticket))
{
long entry = HistoryDealGetInteger(deal_ticket, DEAL_ENTRY);
if(entry == DEAL_ENTRY_IN) actionType = "Open";
else if(entry == DEAL_ENTRY_OUT) actionType = "Close";
else if(entry == DEAL_ENTRY_INOUT) actionType = "Reverse";
}
// Construct filename: FolderName\EURUSD_Open_2026-10-06_13-15-22.png
string filename = StringFormat("%s\\%s_%s_%s.png", InpFolderName, _Symbol, actionType, timeStr);
// Capture the chart (0 = current chart)
if(ChartScreenShot(0, filename, InpWidth, InpHeight, ALIGN_RIGHT))
{
Print("Screenshot saved: ", filename);
}
else
{
Print("Failed to take screenshot. Error code: ", GetLastError());
}
}Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Recording a session for self-review without uploading
How to Install and Run It
1.) Open MetaEditor: Press F4 inside MetaTrader 5.
2.) Create New File: Click New -> Expert Advisor (template) -> Name it AutoScreenshot.
3.) Paste Code: Delete the default template code, paste the code above, and click Compile (or press F7). Look at the "Errors" tab at the bottom to ensure it says 0 errors, 0 warnings.
4.) Attach to Chart: Go back to MetaTrader 5, open the Navigator panel (Ctrl + N), find AutoScreenshot under the Expert Advisors folder, and drag it onto your active trading chart. Ensure "Allow Algo Trading" is checked.
1.) Open MetaEditor: Press F4 inside MetaTrader 5.
2.) Create New File: Click New -> Expert Advisor (template) -> Name it AutoScreenshot.
3.) Paste Code: Delete the default template code, paste the code above, and click Compile (or press F7). Look at the "Errors" tab at the bottom to ensure it says 0 errors, 0 warnings.
4.) Attach to Chart: Go back to MetaTrader 5, open the Navigator panel (Ctrl + N), find AutoScreenshot under the Expert Advisors folder, and drag it onto your active trading chart. Ensure "Allow Algo Trading" is checked.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Recording a session for self-review without uploading
Where MT5 Saves the Files (Important)
MetaTrader operates in a "sandbox" for security, meaning scripts cannot save files anywhere they want (like your Desktop or Documents).
To find your screenshots:
Open MT5.
Go to File -> Open Data Folder.
Navigate to MQL5 -> Files -> Trade_Screenshots.
Pro Tip: If you want these screenshots seamlessly moved to your secure, encrypted Sunday review folder, you can create a Windows shortcut from that MT5 Files directory directly to your encrypted drive.
MetaTrader operates in a "sandbox" for security, meaning scripts cannot save files anywhere they want (like your Desktop or Documents).
To find your screenshots:
Open MT5.
Go to File -> Open Data Folder.
Navigate to MQL5 -> Files -> Trade_Screenshots.
Pro Tip: If you want these screenshots seamlessly moved to your secure, encrypted Sunday review folder, you can create a Windows shortcut from that MT5 Files directory directly to your encrypted drive.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Recording a session for self-review without uploading
To automate this, the best approach is a small PowerShell script that grabs the images from MT5, creates a neatly organized folder with today's date on your encrypted drive, and moves the files. We will then tie it to Windows Task Scheduler so it happens invisibly every day after your session.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Recording a session for self-review without uploading
Locate your MT5 Sandbox Path
MetaTrader hides its files in a hashed directory.
1.) Open MT5 and click File -> Open Data Folder.
2.) Open MQL5 -> Files -> Trade_Screenshots.
3.) Click the address bar at the top of the file explorer and copy the entire folder path. It will look something like: C:\Users\Name\AppData\Roaming\MetaQuotes\Terminal\D0E82...\MQL5\Files\Trade_Screenshots.
MetaTrader hides its files in a hashed directory.
1.) Open MT5 and click File -> Open Data Folder.
2.) Open MQL5 -> Files -> Trade_Screenshots.
3.) Click the address bar at the top of the file explorer and copy the entire folder path. It will look something like: C:\Users\Name\AppData\Roaming\MetaQuotes\Terminal\D0E82...\MQL5\Files\Trade_Screenshots.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Recording a session for self-review without uploading
Create the PowerShell Script
Open Notepad, paste the code below, and save it to your desktop or documents as Move-Trades.ps1 (ensure it does not save as .ps1.txt).
Open Notepad, paste the code below, and save it to your desktop or documents as Move-Trades.ps1 (ensure it does not save as .ps1.txt).
Code: Select all
# 1. Paste your MT5 path and Encrypted Drive path inside the quotes below
$SourceFolder = "C:\Users\YOUR_NAME\AppData\Roaming\MetaQuotes\Terminal\YOUR_MT5_HASH\MQL5\Files\Trade_Screenshots"
$DestDrive = "Z:\Trading_Journal" # Replace Z: with your encrypted drive letter
# 2. Generate today's date for the folder name (e.g., 2026-10-06)
$Today = Get-Date -Format "yyyy-MM-dd"
$DestFolder = Join-Path -Path $DestDrive -ChildPath $Today
# 3. Move the files if any exist
if (Test-Path "$SourceFolder\*.png") {
if (-Not (Test-Path $DestFolder)) {
New-Item -ItemType Directory -Force -Path $DestFolder | Out-Null
}
Move-Item -Path "$SourceFolder\*.png" -Destination $DestFolder -Force
}Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Recording a session for self-review without uploading
Test the Script
Right-click the Move-Trades.ps1 file and select Run with PowerShell. If your encrypted drive is unlocked, it will instantly move any screenshots sitting in MT5 into a new daily folder on your secure drive.
Right-click the Move-Trades.ps1 file and select Run with PowerShell. If your encrypted drive is unlocked, it will instantly move any screenshots sitting in MT5 into a new daily folder on your secure drive.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Recording a session for self-review without uploading
Automate with Task Scheduler
1.) Now make Windows run it for you every day after the London session closes.
2.) Press the Windows Key, type Task Scheduler, and open it.
3.) Click Create Basic Task on the right side. Name it "MT5 Auto Move".
4.) Trigger: Select Daily and set the time to after your usual trading hours (e.g., 4:00 PM).
5.) Action: Select Start a program.
6.) Program/script: Type powershell.exe
7.) Add arguments: Type -WindowStyle Hidden -ExecutionPolicy Bypass -File "C:\Path\To\Your\Move-Trades.ps1" (replace with the actual path to your saved script).
8.) Finish and save.
1.) Now make Windows run it for you every day after the London session closes.
2.) Press the Windows Key, type Task Scheduler, and open it.
3.) Click Create Basic Task on the right side. Name it "MT5 Auto Move".
4.) Trigger: Select Daily and set the time to after your usual trading hours (e.g., 4:00 PM).
5.) Action: Select Start a program.
6.) Program/script: Type powershell.exe
7.) Add arguments: Type -WindowStyle Hidden -ExecutionPolicy Bypass -File "C:\Path\To\Your\Move-Trades.ps1" (replace with the actual path to your saved script).
8.) Finish and save.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Recording a session for self-review without uploading
Now, you can trade the London session, let the EA snap the entries and exits automatically, and as soon as your scheduled time hits, the files will vanish from the local drive and appear categorized by date on your encrypted drive.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.