Re: 🔺 MT5 XARD - Simple Trend Following Trading System

2191
Thank you very much for the update and all the hard work you put into this system!

Would it be possible to implement some kind of push notification or alert whenever a potential trading setup appears (Anchor → Foundation)?

Unfortunately, I'm unable to monitor the charts continuously while I'm at work. Getting a notification on my phone when a potential entry is forming would be incredibly helpful, so I could quickly check the charts and decide whether to take the trade. ;)

Thanks again for your amazing work!


Re: 🔺 MT5 XARD - Simple Trend Following Trading System

2192
Candles appear to be lagging

I inspected XU Candles v1.01 -- STOIC Edition.mq5 and found the exact reason why fellow traders report the candlesticks lagging behind price during fast moves, and why you haven't noticed it on your setup.

Why Fellow Traders See Candlestick Lag in v1.01

The Fast-Path Bypassed on Every Breakout Tick (lines 489–518): In v1.01, the intra-bar fast path required:

mql5
bool sameBarFastPath = (prev_calculated == rates_total &&
g_checkpointValid &&
time[last] == g_lastBarTime &&
high[last] == g_lastBarHigh &&
low[last] == g_lastBarLow &&
showSsl == g_lastShowSsl);

Whenever the live forming candle pushed a new intra-bar High or Low (or whenever a new M1 bar opened), sameBarFastPath became false. During a fast Gold breakout, almost every tick sets a new intra-bar High or Low.

When sameBarFastPath was false, v1.01 reset startBar = 0 and recalculated the entire chart history from bar 0:
Zeroed and ran two full passes of CalcSema3() across all rates_total bars.
Re-ran the VWAP loop from i = 0 to rates_total - 1, calling TimeToStruct() twice per bar inside IsNewAnchor().
Rewrote all 8 plot buffers from index 0 to rates_total - 1, forcing MT5 to re-upload the entire historical plot buffer on every breakout tick.
Why I didn't feel it: With a clean setup and reasonable Max bars in chart, my Ryzen CPU blasts through the loop in a couple of milliseconds. Fellow traders who leave MT5's Max bars in chart at 100,000 or Unlimited force the indicator to run 300,000+ loop iterations and 200,000+ TimeToStruct() calls on every single new-high/new-low tick, backing up the indicator queue behind the live Bid line.

Unconditional PlotIndexSetInteger & Synchronous Chart Queries on Every Tick (lines 366–392, lines 485–486):

ApplySslVisibility() called PlotIndexSetInteger(1..2, PLOT_DRAW_TYPE, draw) on every tick, even when visibility hadn't changed, invalidating MT5's plot state on every tick.
SslLinesVisible() and UpdateHeaderColor() called synchronous chart object queries (ObjectFind, ObjectGetString, ObjectSetInteger) on every tick. In MT5, reading chart object strings inside OnCalculate forces the calculation thread to wait on the chart UI message queue.
What Changed in XU Candles v1.02 -- STOIC Edition

I left v1.01 completely untouched and created + compiled v1.02:

Source: XU Candles v1.02 -- STOIC Edition.mq5
Compiled Binary: XU Candles v1.02 -- STOIC Edition.ex5 (0 errors, 0 warnings)
Key Optimizations in v1.02:
True
𝑂
(
1
)
O(1) Incremental SEMA3 + VWAP Checkpoint Engine:
Intra-bar tick (within current High/Low): Updates only bar[last] in ~15 CPU operations (1 bar).
Intra-bar breakout tick (new High or Low): Instead of recalculating 100,000+ bars from bar 0, it restores the Pass-1 backstep tail and Pass-2 active pivot from last - 1 and evaluates only last - backstep .. last (6 bars total), while producing 100% bit-for-bit identical results to a full rebuild.
New bar open: Advances the checkpoint forward by 1 bar without ever re-scanning history from bar 0.
State-Cached Plot & Header Updates:
ApplySslVisibility() and UpdateHeaderColor() now cache their last applied state and only touch MT5 chart/plot APIs when a change actually occurs.
Button polling in SslLinesVisible() is throttled to 1s while keeping instant 0ms response via OnChartEvent(VWAP_SSL_VIS_EVENT).
Fast Integer Day-Boundary Check in IsNewAnchor():
Uses time / 86400 == time / 86400 to bypass TimeToStruct() on 99.9% of bars even during initial chart load.

Hope this helps,
XARD777
XARD: If Carlsberg made charts... Probably the best charts in the world