OPENSTRATS

Gold–silver morning divergence at 8.58×

Research

Jan 2009–Oct 2026 MT5 results showed +$219,441.02 net and 71.93% maximum equity drawdown.

SYM XAUUSD, XAGUSDTF H1TEST 2014-01-01 → 2026-10-31UPDATED VIEWS 0DOWNLOADS 0#mean-reversion

BACKTESTS · 3

2 of 3
NET PROFIT · USD
+486,329
from 100,000 USD
RETURN
+486.3%
CAGR
+14.8%
12.8 yrs
PROFIT FACTOR
1.17
SHARPE
2.57
MAX DD
-59.2%
equity, relative
RECOVERY
0.73
TRADES
2879
39.7% win

EQUITY · BALANCE (USD)

Metals_GoldSilverLag858 · XAUUSD H1 · quality 61% real ticks · drag to zoom, double-click to reset

MONTHLY RETURNS

% of balance at month start
YearJanFebMarAprMayJunJulAugSepOctNovDecYear
201413.5%2.4%-0.3%-1.6%····-1.0%1.8%-0.1%2.0%+17.0%
2015-5.4%-11.8%-6.2%·12.6%0.2%-5.0%-1.0%-3.1%1.0%10.8%1.6%-8.4%
2016-2.7%4.1%-0.3%13.7%3.8%-6.6%-1.4%-2.5%-2.0%·-7.3%-0.2%-3.1%
2017-1.2%···-1.3%·-2.8%-3.7%····-8.7%
2018·····4.1%·0.8%··0.8%·+5.8%
2019·····-5.1%-2.5%4.8%-7.2%-1.1%·-0.3%-11.3%
2020-0.8%-8.0%0.4%1.6%-14.6%-5.5%6.5%18.5%-11.7%3.0%5.2%3.0%-6.5%
202130.4%2.9%-6.8%-0.6%0.2%-7.3%··3.1%1.3%11.0%4.1%+39.4%
20226.4%11.2%6.9%10.6%-2.5%-11.3%3.5%0.4%-8.5%4.8%1.8%4.7%+28.4%
2023-6.9%·12.8%-5.2%2.3%9.4%·3.2%2.6%22.4%-2.5%5.3%+48.1%
2024-0.7%-5.2%-1.4%3.7%0.1%-4.2%-2.7%19.3%-10.1%-1.0%15.3%5.2%+15.6%
20258.4%0.7%-3.8%18.8%2.9%-12.2%-4.6%-4.9%4.6%35.2%-0.7%8.1%+55.1%
202635.2%-3.3%16.9%0.4%78.8%-14.8%-37.5%5.7%-8.8%5.4%··+48.4%

TRADE STATS

Gross profit3,297,388.20Gross loss-2,811,059.03
Expected payoff168.92Total deals4594
Long trades1423 (41.7%)Short trades1456 (37.7%)
Largest win160,753.44Largest loss-204,878.05
Average win2,887.38Average loss-1,618.34
Max consec. wins18Max consec. losses28
Balance DD max594,300.41 (54.0%)Equity DD max670,130.40 (59.2%)
Leverage1:100BrokerWithheld
All report fields (46)
History Quality61% real ticks
Bars75757
Ticks514929864
Symbols1
Total Net Profit486 329.17
Balance Drawdown Absolute37 997.49
Equity Drawdown Absolute38 409.85
Gross Profit3 297 388.20
Balance Drawdown Maximal594 300.41 (53.30%)
Equity Drawdown Maximal670 130.40 (57.43%)
Gross Loss-2 811 059.03
Balance Drawdown Relative53.98% (72 739.92)
Equity Drawdown Relative59.16% (89 229.30)
Profit Factor1.17
Expected Payoff168.92
Margin Level929.26%
Recovery Factor0.73
Sharpe Ratio2.57
Z-Score-24.56 (99.74%)
AHPR1.0009 (0.09%)
LR Correlation0.84
OnTester result586329.1700000009
GHPR1.0006 (0.06%)
LR Standard Error120 768.06
Total Trades2879
Short Trades (won %)1456 (37.71%)
Long Trades (won %)1423 (41.67%)
Total Deals4594
Profit Trades (% of total)1142 (39.67%)
Loss Trades (% of total)1737 (60.33%)
Largest profit trade160 753.44
Largest loss trade-204 878.05
Average profit trade2 887.38
Average loss trade-1 618.34
Maximum consecutive wins ($)18 (39 809.22)
Maximum consecutive losses ($)28 (-87 616.09)
Maximal consecutive profit (count)170 325.60 (2)
Maximal consecutive loss (count)-249 652.25 (16)
Average consecutive wins3
Average consecutive losses5
Correlation (Profits,MFE)0.59
Correlation (Profits,MAE)0.53
Correlation (MFE,MAE)-0.2624
Minimal position holding time0:45:31
Maximal position holding time6:14:20
Average position holding time3:51:34

NOTES

Trades gold against its relative morning move when gold and silver diverge by more than 0.7 percentage points. Target exposure is 8.58× equity. The signal compares broker-time returns from 01:00 through 07:59. Gold is bought when it lags silver and sold when it leads. The trade window runs from 08:00 to 14:00. Silver supplies the reference price. Only gold is traded. Each size is a separate test of the same rule.

Jan 2009–Oct 2026: +$219,441.02 net, +$1,025.43 per month, 0.544% compounded monthly, 71.93% maximum equity drawdown. Jan 2014–Oct 2026: +$486,329.17 net, +$3,157.98 per month, 1.155% compounded monthly, 59.16% maximum equity drawdown. Jan 2025–Oct 2026: +$131,124.55 net, +$5,960.21 per month, 3.882% compounded monthly, 57.47% maximum equity drawdown. Each MT5 window starts with USD 100,000. The later windows overlap the long history. The tester booked 0.0014% of closing notional, with swap and spread reflected in the net results. Tick coverage varies over time. Real gold and silver tick history begins in January 2019. The tester used generated prices during earlier periods and during later quote gaps, including gaps in gold during 2025.

InputValueOptimise (start / step / stop)Section
TesterOnlytrue
EquityLogId0
Exposure8.58
Metals_GoldSilverLag858.mq5402 lines · 15.0 KB · 2026-11-29 ↓ download
View source
#property strict
#property description "Test-only broker precious-metal strategy"
const ulong LockedMagic=827968842;
const string LockedAnchor="XAUUSD";
string LegNames[]={"XAUUSD"},MapNames[]={"XAUUSD"},MapSymbols[]={"XAUUSD"};
double LegWeights[]={1.0};
datetime MetalDay(const datetime t) { return (datetime)((long)t/86400*86400); }
int MetalSlot(const string sym) { return sym=="XAUUSD"?0:1; }
int MetalSign(const double v) { return v>0?1:(v<0?-1:0); }
double MetalTrend(const string sym,const datetime h,const int n,const bool longCash)
{
   MqlRates r[]; const datetime end=MetalDay(h)-1;
   int cnt=CopyRates(sym,PERIOD_D1,end,n,r);
   if(cnt!=n) return 0;
   double sum=0;
   for(int i=0;i<n;i++) sum+=r[i].close;
   int sign=MetalSign(r[n-1].close-sum/n);
   return longCash?MathMax(0,sign):sign;
}
double MetalChannel(const string sym,const datetime h,const int n,const int back,const int fade)
{
   MqlRates r[];int count=n+back;
   if(CopyRates(sym,PERIOD_D1,MetalDay(h)-1,count,r)!=count) return 0;
   for(int t=count-1;t>=n;t--)
   {
      double hi=r[t-n].high,lo=r[t-n].low;
      for(int j=t-n+1;j<t;j++){hi=MathMax(hi,r[j].high);lo=MathMin(lo,r[j].low);}
      if(r[t].close>hi) return 1-2*fade;
      if(r[t].close<lo) return -(1-2*fade);
   }
   return 0;
}
double MetalOpenBreak(const string sym,const datetime h,const int begin,const int stop,const int flatten,const int fade)
{
   MqlDateTime tm;TimeToStruct(h,tm);
   if(tm.hour<=stop || tm.hour>=flatten) return 0;
   MqlRates r[]; const datetime day=MetalDay(h);
   int n=CopyRates(sym,PERIOD_H1,day,h-1,r);
   double hi=0,lo=DBL_MAX;int seen=0,side=0;
   for(int j=0;j<n;j++)
   {
      int k=(int)((r[j].time-day)/3600);
      if(k>=begin && k<stop) {hi=MathMax(hi,r[j].high);lo=MathMin(lo,r[j].low);seen++;}
      if(seen==stop-begin && k>=stop && k<flatten-1)
      {
         if(r[j].close>hi) side=1;
         else if(r[j].close<lo) side=-1;
      }
   }
   return side*(1-2*fade);
}
int MetalPairHistory(const datetime cutoff,const datetime from,datetime &dates[],double &gold[],double &silver[])
{
   MqlRates a[],b[];
   int na=CopyRates("XAUUSD",PERIOD_D1,from,cutoff-1,a);
   int nb=CopyRates("XAGUSD",PERIOD_D1,from,cutoff-1,b);
   if(na<=0 || nb<=0)return 0;
   ArrayResize(dates,MathMin(na,nb));ArrayResize(gold,MathMin(na,nb));ArrayResize(silver,MathMin(na,nb));
   int i=0,j=0,used=0;
   while(i<na && j<nb)
   {
      datetime da=MetalDay(a[i].time),db=MetalDay(b[j].time);
      if(da<db){i++;continue;}
      if(db<da){j++;continue;}
      dates[used]=da;gold[used]=a[i].close;silver[used]=b[j].close;i++;j++;used++;
   }
   return used;
}
double MetalRotation(const string sym,const datetime h,const int n,const int style)
{
   datetime tt[];double a[],b[];datetime day=MetalDay(h);
   int size=MetalPairHistory(day,day-(n*3+30)*86400,tt,a,b);
   if(size<=n) return 0;
   double x=a[size-1]/a[size-1-n]-1,y=b[size-1]/b[size-1-n]-1;
   int dir=MetalSign(x-y);
   if(style==0)return (sym=="XAUUSD"?0.5:-0.5)*dir;
   if(sym=="XAUUSD" && dir>0 && (style!=2 || x>0)) return 1;
   if(sym=="XAGUSD" && dir<0 && (style!=2 || y>0)) return 1;
   return 0;
}
double MetalValue(const string sym,const datetime h,const int years)
{
   MqlDateTime m;TimeToStruct(MetalDay(h),m);m.day=1;
   datetime cut=StructToTime(m),tt[];double a[],b[];
   int count=MetalPairHistory(cut,cut-(years*366+40)*86400,tt,a,b);
   if(count<2)return 0;
   MqlDateTime past;TimeToStruct(tt[count-1],past);past.year-=years;
   if(past.mon==2 && past.day==29 && (past.year%4!=0 || (past.year%100==0 && past.year%400!=0)))past.day=28;
   datetime limit=StructToTime(past);int i=count-1;
   while(i>=0 && tt[i]>limit)i--;
   if(i<0) return 0;
   return (sym=="XAUUSD"?0.5:-0.5)*MetalSign(a[i]/a[count-1]-b[i]/b[count-1]);
}
bool MetalWeekday(const datetime hour,const int code)
{
   MqlDateTime t;TimeToStruct(hour,t);
   if(code<=5)return t.day_of_week==code;
   if(code==9)return t.day>=10 && t.day<=20;
   if(t.day_of_week==0 || t.day_of_week==6)return false;
   datetime d=MetalDay(hour);int before=0,after=0;
   MqlDateTime q;
   for(int i=1;i<=4;i++)
   {
      TimeToStruct(d-i*86400,q);
      if(q.mon!=t.mon)break;
      if(q.day_of_week>=1 && q.day_of_week<=5)before++;
   }
   for(int i=1;i<=4;i++)
   {
      TimeToStruct(d+i*86400,q);
      if(q.mon!=t.mon)break;
      if(q.day_of_week>=1 && q.day_of_week<=5)after++;
   }
   if(code==6)return before<2;
   if(code==7)return after<2;
   return before<2 || after<2;
}
bool MetalSessionChange(const string instrument,const datetime hour,const int h0,const int h1,double &ret)
{
   datetime day=MetalDay(hour),t0=day+h0*3600,t1=day+(h1-1)*3600;
   int a=iBarShift(instrument,PERIOD_H1,t0,true),b=iBarShift(instrument,PERIOD_H1,t1,true);
   if(a<0 || b<0)return false;
   double opening=iOpen(instrument,PERIOD_H1,a),ending=iClose(instrument,PERIOD_H1,b);
   if(opening<=0 || ending<=0)return false;
   ret=ending/opening-1;return true;
}
double MetalDiscovery(const string sym,const datetime h,const int start,const int end,const int flatten,const double threshold,const int direction)
{
   MqlDateTime t;TimeToStruct(h,t);
   if(t.hour<end || t.hour>=flatten)return 0;
   double g=0,s=0;
   if(!MetalSessionChange("XAUUSD",h,start,end,g) || !MetalSessionChange("XAGUSD",h,start,end,s))return 0;
   int side=g-s>threshold?1:(g-s< -threshold?-1:0);
   return side*direction*(sym=="XAUUSD"?1:-1);
}
datetime MetalFirstCommonDay(const datetime hour,const int half)
{
   const datetime current=MetalDay(hour);
   MqlDateTime t;TimeToStruct(current,t);t.day=1;
   if(half==6)t.mon=t.mon>6?7:1;
   datetime start=StructToTime(t);
   if(current==start)return current;
   datetime times[];double au[],ag[];
   const int used=MetalPairHistory(current,start,times,au,ag);
   return used>0?times[0]:current;
}
double MetalExternal(const datetime cutoff,const int &events[],const int &states[])
{
   int lo=0,hi=ArraySize(events)-1;
   while(lo<=hi){int m=(lo+hi)/2;if(events[m]<=(long)cutoff)lo=m+1;else hi=m-1;}
   return hi<0?0:states[hi];
}
double Member0(const string sym,const datetime hour)
{
   if(sym!="XAUUSD") return 0;
   MqlDateTime tm; TimeToStruct(hour,tm);
   return 1.0*MetalDiscovery(sym,hour,1,8,14,0.007,-1);
}

bool SelectedWeight(const int slot,const string sym,const datetime hour,double &w)
{
   w=(Member0(sym,hour))/1.0;
   return MathIsValidNumber(w);
}

// Shared MT5 execution for explicitly frozen, per-symbol H1-opening targets.
// The assembler declares LegNames, the maximum LegWeights, the
// broker symbol map, default exposure, and the SelectedWeight() callback.
#include <Trade/Trade.mqh>
input bool TesterOnly = true;
input ulong EquityLogId = 0;
input double Exposure = 8.58;
CTrade dsTrade;
string dsSymbols[];
bool dsDone[],dsReady[];
int dsSides[];
double dsVolumes[];
datetime dsHour=0, dsWake=0;
double dsOpeningEquity=0;
bool dsFinished=false;
uint dsErrors=0;
int dsMonthlyFile=INVALID_HANDLE;
datetime dsMonthStart=0,dsNextMonth=0,dsLastTick=0,dsFirstMonthTick=0;
double dsLastMarkedEquity=0,dsLastMarkedBalance=0;

void DSWriteMonth(const bool finalRow,const double ending)
{
   if(dsMonthlyFile==INVALID_HANDLE || dsLastTick<=0) return;
   FileWrite(dsMonthlyFile,TimeToString(dsMonthStart,TIME_DATE),TimeToString(dsFirstMonthTick,TIME_DATE|TIME_SECONDS),
             TimeToString(dsLastTick,TIME_DATE|TIME_SECONDS),DoubleToString(dsLastMarkedEquity,2),
             DoubleToString(dsLastMarkedBalance,2),finalRow?DoubleToString(ending,2):"");
   FileFlush(dsMonthlyFile);
   PrintFormat("Research tester monthly equity %s %.2f",TimeToString(dsMonthStart,TIME_DATE),dsLastMarkedEquity);
}

void DSObserveMonth(const datetime now)
{
   if(dsMonthlyFile==INVALID_HANDLE) return;
   if(now>=dsNextMonth)
   {
      DSWriteMonth(false,0);
      MqlDateTime t;
      if(!TimeToStruct(now,t)) return;
      t.day=1; t.hour=0; t.min=0; t.sec=0;
      dsMonthStart=StructToTime(t); dsFirstMonthTick=now;
      if(t.mon==12) { t.year++; t.mon=1; } else t.mon++;
      dsNextMonth=StructToTime(t);
   }
   dsLastTick=now;
   dsLastMarkedEquity=AccountInfoDouble(ACCOUNT_EQUITY);
   dsLastMarkedBalance=AccountInfoDouble(ACCOUNT_BALANCE);
}

string DSBrokerSymbol(const string canonical)
{
   for(int i=0;i<ArraySize(MapNames);i++)
      if(MapNames[i]==canonical) return MapSymbols[i];
   return "";
}

bool DSAllowed(const string canonical)
{
   return canonical=="XAUUSD" || canonical=="XAGUSD";
}

bool DSSized(const string sym,const int side,const MqlTick &tick,const double allocation,double &lots)
{
   lots=0;
   if(side==0) return true;
   const double price=(tick.bid+tick.ask)/2;
   const double contract=SymbolInfoDouble(sym,SYMBOL_TRADE_CONTRACT_SIZE);
   const double step=SymbolInfoDouble(sym,SYMBOL_VOLUME_STEP);
   if(price<=0 || contract<=0 || step<=0 || dsOpeningEquity<=0) return false;
   const string account=AccountInfoString(ACCOUNT_CURRENCY);
   const string base=SymbolInfoString(sym,SYMBOL_CURRENCY_BASE);
   const string quote=SymbolInfoString(sym,SYMBOL_CURRENCY_PROFIT);
   double notional=contract;
   if(base!=account)
   {
      if(quote==account) notional=contract*price;
      else
      {
         double move=0;
         if(!OrderCalcProfit(ORDER_TYPE_BUY,sym,1.0,price,price*1.01,move) || move<=0) return false;
         notional=move*100;
      }
   }
   double raw=dsOpeningEquity*Exposure*allocation/notional;
   const double bound=SymbolInfoDouble(sym,SYMBOL_VOLUME_LIMIT);
   if(bound>0) raw=MathMin(raw,bound);
   lots=NormalizeDouble(MathFloor(raw/step+1e-10)*step,8);
   if(lots<SymbolInfoDouble(sym,SYMBOL_VOLUME_MIN)) lots=0;
   return true;
}

bool DSFilled(const bool sent,const string symbol)
{
   const uint rc=dsTrade.ResultRetcode();
   if(sent && (rc==TRADE_RETCODE_DONE || rc==TRADE_RETCODE_DONE_PARTIAL)) return true;
   dsErrors++;
   if(dsErrors<=8 || dsErrors%500==0)
      PrintFormat("Research execution %s: %u %s (events %u)",symbol,rc,dsTrade.ResultRetcodeDescription(),dsErrors);
   return false;
}

bool DSAlign(const string sym,int side,const double lots)
{
   // Return true only after actual position volume has been confirmed.
   if(lots==0) side=0;
   const bool hedge=AccountInfoInteger(ACCOUNT_MARGIN_MODE)==ACCOUNT_MARGIN_MODE_RETAIL_HEDGING;
   double owned=0;
   ulong reduceTicket=0;
   double reduceLots=0;
   if(!dsTrade.SetTypeFillingBySymbol(sym)) return false;
   for(int i=PositionsTotal()-1;i>=0;i--)
   {
      const ulong ticket=PositionGetTicket(i);
      if(ticket==0 || PositionGetString(POSITION_SYMBOL)!=sym) continue;
      if((ulong)PositionGetInteger(POSITION_MAGIC)!=LockedMagic)
      {
         if(!hedge) return true; // Shared net position cannot be attributed safely.
         continue;
      }
      const int held=PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY?1:-1;
      const double v=PositionGetDouble(POSITION_VOLUME);
      if(held!=side)
      {
         DSFilled(dsTrade.PositionClose(ticket),sym);
         return false;
      }
      owned+=v;
      if(v>reduceLots) { reduceTicket=ticket; reduceLots=v; }
   }
   const double step=SymbolInfoDouble(sym,SYMBOL_VOLUME_STEP);
   const double maximum=SymbolInfoDouble(sym,SYMBOL_VOLUME_MAX);
   const double minimum=SymbolInfoDouble(sym,SYMBOL_VOLUME_MIN);
   if(step<=0 || maximum<=0 || minimum<=0) return false;
   const double diff=NormalizeDouble(lots-owned,8);
   if(MathAbs(diff)<minimum-step*0.01) return true;
   double qty=MathMin(MathAbs(diff),maximum);
   qty=NormalizeDouble(MathFloor(qty/step+1e-8)*step,8);
   if(qty<minimum) return true;
   if(hedge && diff<0)
   {
      if(qty>=reduceLots-step*0.01)
         DSFilled(dsTrade.PositionClose(reduceTicket),sym);
      else
         DSFilled(dsTrade.PositionClosePartial(reduceTicket,qty),sym);
      return false;
   }
   const bool buy=(side>0)==(diff>0);
   DSFilled(buy?dsTrade.Buy(qty,sym):dsTrade.Sell(qty,sym),sym);
   return false;
}

int OnInit()
{
   if((!TesterOnly || !MQLInfoInteger(MQL_TESTER)) || Exposure<=0 || !MathIsValidNumber(Exposure)) return INIT_PARAMETERS_INCORRECT;
   if(!SymbolSelect("XAUUSD",true) || !SymbolSelect("XAGUSD",true)) return INIT_FAILED;
   const int n=ArraySize(LegNames);
   if(n==0 || n!=ArraySize(LegWeights) || ArraySize(MapNames)!=ArraySize(MapSymbols)) return INIT_PARAMETERS_INCORRECT;
   ArrayResize(dsSymbols,n); ArrayResize(dsDone,n); ArrayResize(dsReady,n);
   ArrayResize(dsSides,n); ArrayResize(dsVolumes,n);
   double total=0;
   for(int i=0;i<n;i++)
   {
      dsSymbols[i]=DSBrokerSymbol(LegNames[i]);
      if(!DSAllowed(LegNames[i]) || dsSymbols[i]=="" || LegWeights[i]<=0 || !SymbolSelect(dsSymbols[i],true)) return INIT_PARAMETERS_INCORRECT;
      if(SymbolInfoString(dsSymbols[i],SYMBOL_CURRENCY_PROFIT)!="USD" || AccountInfoString(ACCOUNT_CURRENCY)!="USD") return INIT_PARAMETERS_INCORRECT;
      total+=LegWeights[i];
   }
   if(total<=0 || _Symbol!=LockedAnchor) return INIT_PARAMETERS_INCORRECT;
   if(MQLInfoInteger(MQL_TESTER) && EquityLogId>0)
   {
      const string fn="StrategyResearch\\monthly-"+IntegerToString((long)EquityLogId)+".csv";
      dsMonthlyFile=FileOpen(fn,FILE_WRITE|FILE_CSV|FILE_ANSI|FILE_COMMON,',');
      if(dsMonthlyFile==INVALID_HANDLE) { PrintFormat("Research tester monthly file error %d",GetLastError()); return INIT_FAILED; }
      FileWrite(dsMonthlyFile,"month","first_tick","last_tick","marked_equity","marked_balance","final_tester_equity");
   }
   dsTrade.SetExpertMagicNumber(LockedMagic);
   dsTrade.SetAsyncMode(false);
   return INIT_SUCCEEDED;
}

void OnTick()
{
   const datetime now=TimeCurrent();
   DSObserveMonth(now);
   const datetime hour=(datetime)(((long)now/3600)*3600);
   if(hour!=dsHour)
   {
      dsHour=hour;
      dsWake=0;
      dsFinished=false;
      dsOpeningEquity=AccountInfoDouble(ACCOUNT_EQUITY);
      ArrayInitialize(dsDone,false);
      ArrayInitialize(dsReady,false);
   }
   if(dsFinished || now<dsWake) return;
   bool all=true;
   for(int i=0;i<ArraySize(dsSymbols);i++)
   {
      if(dsDone[i]) continue;
      MqlTick tick;
      const string sym=dsSymbols[i];
      if(!SymbolInfoTick(sym,tick) || tick.time<hour || tick.time>now || tick.bid<=0 ||
         tick.ask<tick.bid || iTime(sym,PERIOD_H1,0)!=hour) { all=false; continue; }
      if(!dsReady[i])
      {
         double weight=0;
         if(!SelectedWeight(i,sym,hour,weight) || !MathIsValidNumber(weight) ||
            MathAbs(weight)>LegWeights[i]+1e-8) { all=false; continue; }
         const int side=weight>0?1:(weight<0?-1:0);
         if(!DSSized(sym,side,tick,MathAbs(weight),dsVolumes[i])) { all=false; continue; }
         dsSides[i]=side;
         dsReady[i]=true;
      }
      dsDone[i]=DSAlign(sym,dsSides[i],dsVolumes[i]);
      if(!dsDone[i]) all=false;
   }
   if(dsMonthlyFile!=INVALID_HANDLE)
   {
      dsLastMarkedEquity=AccountInfoDouble(ACCOUNT_EQUITY);
      dsLastMarkedBalance=AccountInfoDouble(ACCOUNT_BALANCE);
   }
   dsFinished=all;
   dsWake=now+(now-hour<30?1:30);
}

double OnTester()
{
   const double ending=TesterStatistics(STAT_INITIAL_DEPOSIT)+TesterStatistics(STAT_PROFIT);
   DSWriteMonth(true,ending);
   return ending;
}

void OnDeinit(const int reason)
{
   if(dsMonthlyFile!=INVALID_HANDLE) FileClose(dsMonthlyFile);
   PrintFormat("Research execution ended, trade error responses=%u.",dsErrors);
}

FILES

every upload is kept
TypeFileNotesSizeDLSHA-256Uploaded
FILEMetals_GoldSilverLag858_monthly_equity.csv latestMonth-end marked equity by independent MT5 account. A partial month is identified by its observed broker timestamps.40.3 KB0ac4ca4f1cd182026-11-29 01:23
BACKTESTMetals_GoldSilverLag858_holdfee.html latestMT5 Strategy Tester, USD 100,000 initial capital. 950 closed trades. Native net P&L includes −$4,273.33 commission and +$0.00 swap. MT5 history quality: 100% real ticks. Rejected requests: 0.825.8 KB082e0ea268b5a2026-11-29 01:23
BACKTESTMetals_GoldSilverLag858_fullfee.html latestMT5 Strategy Tester, USD 100,000 initial capital. 2,879 closed trades. Native net P&L includes −$16,151.58 commission and +$0.00 swap. MT5 history quality: 61% real ticks. Rejected requests: 0.2.2 MB02da4657c0f5f2026-11-29 01:23
BACKTESTMetals_GoldSilverLag858_continuousfee.html latestMT5 Strategy Tester, USD 100,000 initial capital. 3,871 closed trades. Native net P&L includes −$10,558.96 commission and +$0.00 swap. MT5 history quality: 43% real ticks. Rejected requests: 0.2.9 MB09d53a8457bf82026-11-29 01:23
PARAMSMetals_GoldSilverLag858.set latestStrategy MT5 Strategy Tester preset. Exposure 8.58×.96 B0578d8ec0e6fb2026-11-29 01:23
SOURCEMetals_GoldSilverLag858.mq5 latestStrategy MQL5 source. Trade rules and sizing are preserved. The optional equity log uses a public identifier.15.0 KB0d76b72cd36062026-11-29 01:23

Other sizes of this rule

This page is the 8.58× exposure. The main research page is the 1.00× baseline: Gold–silver morning divergence at 1.00×. Other sizes: 0.90×, 1.22×, 5.53× and 8.58×. Figures scale with the multiplier. They are Strategy Tester simulations, not live results.

MORE METALS STRATEGIES

all Metals →