▲ 2 r/metatrader+1 crossposts

Need help aligning XAUUSD session highs/lows with MT5 broker time vs Pakistan time

Post
Hi everyone,
I trade XAUUSD (Gold) on MT5, mostly on M5, and I’m trying to build a clean session-based framework for liquidity / inducement / session high-low analysis. I’m currently stuck on the timezone and session alignment part and would really appreciate guidance from someone experienced with MT5 session mapping.
My issue
I want to mark the previous day’s session highs and lows for:
Asian session high / low
London session high / low
New York session high / low
Killzones
But I’m confused about which timezone I should anchor them to so that the levels are correct and consistent on my MT5 chart.
My setup
Instrument: XAUUSD
Platform: MetaTrader 5
Timeframe: mostly M5, sometimes H1
My local timezone: Pakistan (UTC+5)
From comparing chart time to local time, my broker/server time appears to be GMT+3 / UTC+3
Where I’m confused
I’m seeing three different “clocks” involved and I’m not sure which one I should use for session highs/lows:
Broker / MT5 server time
This is the actual time printed on my MT5 chart candles.
Pakistan local time (UTC+5)
This is my local time, but obviously the chart isn’t necessarily built on this clock.
New York / ICT-style session time
A lot of SMC / ICT material defines Asia, London, and New York using New York session logic rather than broker time.
What I want to know
For XAUUSD on MT5, if my broker/server time is UTC+3, what is the best professional way to define and mark the sessions for previous day session highs/lows?
Specifically, I need help with these questions:
Should I mark Asia / London / New York highs and lows using broker/server time, so that the session levels match my MT5 candles exactly?
Or should I define them using New York time / ICT session time and then convert them onto the broker chart?
For someone trading gold on M5 and using session liquidity / inducement concepts, which approach is cleaner and more consistent?
If broker time is UTC+3, what exact time ranges would you personally use for:
Asian session
London session
New York session
Do you define them as full session ranges, or do you use killzone-style narrower windows when marking previous day session highs/lows?
My goal
I want one fixed framework so that every day I can correctly mark:
Previous Asia High / Low
Previous London High / Low
Previous New York High / Low
without constantly second-guessing whether I should be using:
broker time,
Pakistan time,
or New York / ICT session time.
If anyone here trades XAUUSD on MT5 and already has a clean way of handling this, I’d really appreciate if you could share:
your preferred session definitions,
what timezone you anchor them to,
and why.
Thanks a lot — I’m trying to build a proper, repeatable session map for gold rather than just eyeballing it.

reddit.com
u/No_Confection_391 — 14 hours ago
▲ 3 r/Mt5

Struggling to optimize my MT5 EA

Hi everyone,
I’m from a medical background and relatively new to algo trading, so I’d really appreciate some guidance from people with more experience in MT5 strategy development and optimization.
I’m currently trying to build an **MT5 Expert Advisor based on an SMC strategy**. I used Claude to help write the initial script, and I’ve been testing it in **MetaTrader 5** using MT5 historical data.
At the moment, I have a working version of the EA with a defined set of strategy parameters, and I’ve already run both **backtesting** and some **forward testing**.

The problem is that the results are not good at all:
**Very high drawdown**
**Low Sharpe ratio**
**Very low profit / weak overall performance**

So I’m trying to understand **how to properly optimize the parameters** and improve the strategy in a structured way rather than just randomly changing inputs.
**What I’m looking for help with:**
**How would you approach optimizing an MT5 EA like this?**
Specifically, how do you decide which parameters to optimize first, and how do you avoid overfitting?
**What metrics should I prioritize during optimization?**
For example, should I focus more on drawdown, Sharpe ratio, profit factor, net profit, recovery factor, etc.?
**How do you structure proper forward testing in MT5?**
I’ve done some testing already, but I’m not sure if I’m doing it correctly. I’d like to understand the best way to split backtest vs forward test periods and validate whether the strategy has any real robustness.
**For an SMC-based EA specifically, what usually matters most?**
For example:
entry confirmation rules
stop-loss / take-profit logic
session filters
risk management
trailing stop / break-even logic
trade frequency filters
**My current workflow**
EA built in **MT5**
Strategy type: **SMC**
Initial code generated with **Claude**, then tested in MetaTrader
Using MT5 historical data for backtesting
Also ran a small amount of forward testing
**My current issue**
I feel stuck because I can generate results, but I don’t yet know how to improve them systematically. I’m especially struggling with:
reducing drawdown
improving Sharpe / consistency
figuring out whether the strategy logic is bad vs the parameters just being poorly tuned
understanding how to do a proper optimization + forward validation cycle
If anyone is experienced with **MT5 optimization, walk-forward testing, or building profitable EAs**, I’d really appreciate your advice.
If it helps, I can also share:
the **strategy parameters**
**backtest results**
**forward test results**
and the **logic of the EA**
Thanks in advance.

u/No_Confection_391 — 1 day ago

Struggling to optimize my MT5 EA

Hi everyone,
I’m from a medical background and relatively new to algo trading, so I’d really appreciate some guidance from people with more experience in MT5 strategy development and optimization.
I’m currently trying to build an MT5 Expert Advisor based on an SMC strategy. I used Claude to help write the initial script, and I’ve been testing it in MetaTrader 5 using MT5 historical data.
At the moment, I have a working version of the EA with a defined set of strategy parameters, and I’ve already run both backtesting and some forward testing.

The problem is that the results are not good at all:
Very high drawdown
Low Sharpe ratio
Very low profit / weak overall performance

So I’m trying to understand how to properly optimize the parameters and improve the strategy in a structured way rather than just randomly changing inputs.
What I’m looking for help with:
How would you approach optimizing an MT5 EA like this?
Specifically, how do you decide which parameters to optimize first, and how do you avoid overfitting?
What metrics should I prioritize during optimization?
For example, should I focus more on drawdown, Sharpe ratio, profit factor, net profit, recovery factor, etc.?
How do you structure proper forward testing in MT5?
I’ve done some testing already, but I’m not sure if I’m doing it correctly. I’d like to understand the best way to split backtest vs forward test periods and validate whether the strategy has any real robustness.
For an SMC-based EA specifically, what usually matters most?
For example:
entry confirmation rules
stop-loss / take-profit logic
session filters
risk management
trailing stop / break-even logic
trade frequency filters
My current workflow
EA built in MT5
Strategy type: SMC
Initial code generated with Claude, then tested in MetaTrader
Using MT5 historical data for backtesting
Also ran a small amount of forward testing
My current issue
I feel stuck because I can generate results, but I don’t yet know how to improve them systematically. I’m especially struggling with:
reducing drawdown
improving Sharpe / consistency
figuring out whether the strategy logic is bad vs the parameters just being poorly tuned
understanding how to do a proper optimization + forward validation cycle
If anyone is experienced with MT5 optimization, walk-forward testing, or building profitable EAs, I’d really appreciate your advice.
If it helps, I can also share:
the strategy parameters
backtest results
forward test results
and the logic of the EA
Thanks in advance.

reddit.com
u/No_Confection_391 — 2 days ago
▲ 21 r/pinescript+2 crossposts

My first failure:

So, I was discussing with claude about EA and algo trading. After a very long discussion, i made my mind that for a noob like me, building an EA is an easy approach.
After sometime, i was watching random videos on yt about trading strategies. I was watching strategy video of a Pakistani forex trader, and casually decided that i will build an EA based on this strategy.
The strategy was uploaded in 2 parts on YouTube. So here are the steps the I follow:
Copy the links and transcripts of both videos
Paste in claude
Asked the claude to build an .mq5 file
Claude give me first one with errors and 1 warning. Then it removed all errors and warnings on my request, it gave me a clear file.
That file i run on mt5 and back test it the strategy. I gave me horrible results. Here i am attaching results.
I also asked the claude to describe results to me, here is the response of:
“Let me pull every number from your three screenshots together first, then walk through what each term means and what the overall picture tells you.
The Headline Result
You started with $5,000 and ended $2,403.58 down — roughly a 48% loss of your test capital, leaving about $2,596. Along the way, your account also suffered an 85.81% drawdown, meaning at its worst point it lost over four-fifths of its peak value. Reading the numbers together, the account actually grew quite a bit first (a 7-trade winning streak added about $9,697, likely pushing the balance up toward roughly $13,900) before a brutal 9-trade losing streak and other losses gave almost all of it back and then some.
Direct answer to your question: as currently configured, this is not a strategy you’d want to run on a real account. Not because the core pattern idea is necessarily worthless, but because the risk management around it let losses snowball into a near-account-destroying swing. I’ll explain why below, and what to change.
Every Term, Explained
Term
Your Result
What It Means
Gross Profit
$33,304.45
The sum of every single winning trade added together (ignoring losses)
Gross Loss
-$35,708.03
The sum of every single losing trade added together
Total Net Profit
-$2,403.58
Gross Profit + Gross Loss. Your actual real result.
Profit Factor
0.93
Gross Profit ÷ Gross Loss. Above 1.0 = profitable overall. Below 1.0 (like yours) = you lost more than you made.
Drawdown (Balance)
85.81% ($11,956.52)
The biggest drop from a peak account value to the lowest point after it, before any recovery. This is the single most important risk number — yours is dangerously high. Most professional risk limits cap this at 10–20%.
Drawdown (Equity)
87.11% ($12,739.13)
Same idea, but also counting the floating (unrealized) loss of trades that were still open at the worst moment, not just closed ones.
Expected Payoff
-$19.38
The average profit or loss per single trade. Negative means, on average, every trade you take loses about $19.
Sharpe Ratio
-1.60
Measures return relative to risk/volatility taken. Positive and above 1.0 is good; negative (like yours) means the risk taken wasn’t rewarded — you took on volatility and got punished for it.
Recovery Factor
-0.19
Net Profit ÷ Max Drawdown. Tells you how well profits “make up for” the worst drawdown. Negative simply reflects that net profit itself is negative.
AHPR
1.0034 (+0.34%)
Average Holding Period Return — the simple average % return per trade. Slightly positive on its own.
GHPR
0.9947 (-0.53%)
Geometric Holding Period Return — the compounded average return per trade, accounting for the fact that each trade’s size depends on the account balance at the time. This is the more “honest” number.
AHPR vs GHPR gap

This is actually a useful diagnostic: when GHPR is meaningfully lower than AHPR (like here), it’s a mathematical signature of high volatility/swings in trade outcomes — exactly matching the huge drawdown you saw.
Z-Score
0.28 (22.05%)
A statistical check for whether your wins/losses are randomly distributed or “streaky” beyond what chance would predict. Close to 0 means your sequence of wins/losses looked close to random — no unusual hidden pattern.
LR Correlation
-0.53
How closely your equity curve matches a smooth straight line going up, measured from -1 to +1. A great strategy is close to +1 (steady climb). Yours is negative, meaning the overall trend line actually slopes downward with a lot of noise around it.
LR Standard Error
$2,402.75
How far, on average, your actual equity curve wandered away from that straight-line trend — in dollars. Nearly half your starting deposit, which confirms a very choppy, non-smooth equity curve.
Margin Level
89.41%
How much of your account’s required margin was being used at the riskiest point. Below 100% is margin-call territory for most brokers; 89.41% means this test got dangerously close to a forced stop-out.
A couple more numbers worth knowing: you took 124 trades (248 “deals,” since every trade has an opening deal and a closing deal). Win rate was 43.55% overall — sells (56 trades) won 46.43% of the time, buys (68 trades) won only 41.18%. Average win was $616.75 against an average loss of $510.11, a roughly 1.2:1 reward-to-risk ratio — reasonable, but not enough to overcome a sub-50% win rate. The one number that stands out as a red flag on its own: your largest single loss was $3,814.97 — about 7.5 times your average loss, which suggests one trade either had a much bigger position size than the others or wasn’t properly contained by its stop loss.
Why It Likely Went This Wrong
Two things in the EA’s current default settings are the most probable culprits, and both are easy to fix:
Position sizing compounds with balance. The EA risks a fixed percentage of your current balance per trade. During that 7-trade win streak, your balance grew substantially — which means every trade after that streak was sized larger in dollar terms than your earlier trades. When the 9-trade loss streak hit right after, it was hitting on inflated position sizes, which is exactly the mechanism that turns a normal losing streak into an 85% drawdown. If InpRiskPct was left above 1%, this effect gets even more severe.
The trend filter was off by default. In the original videos, Ahmad Umair was explicit: trade with the main H1/H4 trend for full targets, and only take counter-trend setups for a quick 1:1. The EA’s InpTrend input defaults to false, meaning it was taking every valid pattern regardless of the higher-timeframe trend, treating with-trend and counter-trend setups identically. Your lower win rate on longs versus shorts is consistent with this — if price was generally choppy or declining through much of this test window, untrend-filtered buy signals would underperform.
What I’d Change Before Re-Testing
In order of impact: lower InpRiskPct to 0.5–1% if it isn’t already there, turn InpTrend on to true so it only takes patterns aligned with the bigger trend, and turn InpHighProbOnly on to true so it only takes the 80–90% same-color-doji setups rather than the lower-probability mixed-color ones. After that, re-run the same backtest and compare — I’d expect the drawdown number especially to drop significantly. It’s also worth extending your date range; ~5–6 months of data (which is what 11,181 M15 bars works out to) is a reasonably solid trade sample (124 trades) but a fairly short window to know if this is representative of how gold behaves across different conditions.
If you check your Inputs tab and tell me what InpRiskPct and InpTrend were actually set to in this run, I can tell you with much more confidence exactly how much of this drawdown came from sizing versus the trend-filter gap — and I can also add a maximum lot-size cap to the code so no single trade can ever balloon the way that $3,814.97 loss did.”

So what now,
I will strict my rules, in mq5, manage the risk per trade, manage the lot size and manage numbers of open trades.

Let’s see what happen, and I will keep doing this until i found a good profitable strategy, and will make its EA.

u/No_Confection_391 — 6 days ago
▲ 6 r/pinescript+1 crossposts

Pine script

Hi guys
I hope you are doing well. I want to share something with you. I and claude are working to build a signal giving indicator for gold from the last 2 weeks and today, claude also gave me a pine script which is quite long and full of stuff.
Actually the story starts with i ask the claude about three most profitable strategies in the world. I gave me 3 options and then i asked it to write a pine script for the 1st strategy.
It gave me the script, it might be full of errors.
Because i came from a medical background so i need a nice teammate whom with i can build that indicator if anyone is interested, please dm me.

And it can be your last try to make it, then we can be rich and change the lives of families.

reddit.com
u/No_Confection_391 — 8 days ago