OPENSTRATS

Gold early session at 0.10×

Research

Jul 2004–Oct 2026 MT5 results showed +$1,983.83 net and 4.36% maximum equity drawdown.

SYM XAUUSDTF H1TEST 2014-01-01 → 2026-10-31UPDATED VIEWS 0DOWNLOADS 0#session-calendar

BACKTESTS · 4

3 of 4
NET PROFIT · USD
-1,957
from 100,000 USD
RETURN
-2.0%
CAGR
-0.2%
12.8 yrs
PROFIT FACTOR
0.95
SHARPE
-0.95
MAX DD
-3.5%
equity, relative
RECOVERY
-0.56
TRADES
3378
48.5% win

EQUITY · BALANCE (USD)

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

MONTHLY RETURNS

% of balance at month start
YearJanFebMarAprMayJunJulAugSepOctNovDecYear
2014-0.0%0.1%-0.2%-0.0%-0.0%-0.1%-0.2%0.1%0.0%-0.1%-0.2%0.1%-0.6%
2015-0.0%0.1%0.1%-0.1%-0.1%-0.1%-0.4%0.1%-0.0%0.1%0.1%0.2%+0.1%
20160.1%-0.1%-0.4%0.1%-0.1%0.3%-0.1%-0.0%-0.1%0.0%0.3%0.2%+0.3%
20170.1%-0.1%0.0%-0.1%-0.1%0.0%-0.1%-0.0%-0.0%-0.1%0.0%0.1%-0.3%
2018-0.1%0.0%-0.1%-0.1%-0.2%-0.1%-0.2%-0.1%0.0%-0.1%-0.0%0.1%-0.8%
20190.1%-0.1%0.0%-0.0%-0.1%0.2%-0.1%-0.1%-0.1%-0.1%-0.1%0.1%-0.4%
2020-0.1%-0.2%-0.5%-0.3%-0.1%-0.1%-0.0%-0.2%-0.2%0.1%0.1%0.1%-1.3%
20210.2%0.1%0.0%0.0%0.2%-0.1%0.1%0.2%0.1%0.0%-0.0%0.1%+1.1%
2022-0.1%0.1%-0.3%-0.2%-0.1%-0.1%-0.0%-0.1%-0.2%-0.0%0.1%0.1%-0.7%
2023-0.0%-0.0%0.1%-0.0%-0.1%-0.1%0.1%0.0%0.1%-0.0%0.0%-0.0%-0.1%
20240.1%0.1%-0.1%0.1%0.0%-0.0%-0.0%-0.0%0.1%0.2%-0.1%0.2%+0.4%
20250.1%-0.0%0.3%0.5%-0.3%-0.2%0.0%-0.0%0.3%0.1%0.1%0.1%+1.0%
20260.3%0.2%-0.0%-0.5%-0.4%-0.3%-0.1%0.2%-0.0%0.0%··-0.6%

TRADE STATS

Gross profit38,533.05Gross loss-40,490.19
Expected payoff-0.58Total deals6719
Long trades3378 (48.5%)Short trades0 (0.0%)
Largest win364.57Largest loss-522.99
Average win23.54Average loss-23.26
Max consec. wins9Max consec. losses10
Balance DD max3,435.23 (3.4%)Equity DD max3,487.87 (3.5%)
Leverage1:100BrokerWithheld
All report fields (46)
History Quality61% real ticks
Bars75757
Ticks514929864
Symbols1
Total Net Profit-1 957.14
Balance Drawdown Absolute3 296.56
Equity Drawdown Absolute3 331.01
Gross Profit38 533.05
Balance Drawdown Maximal3 435.23 (3.43%)
Equity Drawdown Maximal3 487.87 (3.48%)
Gross Loss-40 490.19
Balance Drawdown Relative3.43% (3 435.23)
Equity Drawdown Relative3.48% (3 487.87)
Profit Factor0.95
Expected Payoff-0.58
Margin Level99432.47%
Recovery Factor-0.56
Sharpe Ratio-0.95
Z-Score0.00 (0.00%)
AHPR1.0000 (-0.00%)
LR Correlation-0.73
OnTester result98042.86
GHPR1.0000 (-0.00%)
LR Standard Error646.18
Total Trades3378
Short Trades (won %)0 (0.00%)
Long Trades (won %)3378 (48.46%)
Total Deals6719
Profit Trades (% of total)1637 (48.46%)
Loss Trades (% of total)1741 (51.54%)
Largest profit trade364.57
Largest loss trade-522.99
Average profit trade23.54
Average loss trade-23.26
Maximum consecutive wins ($)9 (126.03)
Maximum consecutive losses ($)10 (-243.86)
Maximal consecutive profit (count)582.19 (8)
Maximal consecutive loss (count)-774.45 (2)
Average consecutive wins2
Average consecutive losses2
Correlation (Profits,MFE)0.67
Correlation (Profits,MAE)0.68
Correlation (MFE,MAE)0.1225
Minimal position holding time0:33:00
Maximal position holding time22:05:00
Average position holding time5:58:17

NOTES

Buys gold from 01:00 to 07:00 broker time on eligible trading days, targeting 10% of equity. The account returns to cash outside the session. The positive July 2004 and January 2025 starts coexist with losses from the January 2009 and January 2014 starts.

Jul 2004–Oct 2026: +$1,983.83 net, +$7.40 per month, 0.007% compounded monthly, 4.36% maximum equity drawdown. Jan 2009–Oct 2026: −$602.87 net, −$2.82 per month, -0.003% compounded monthly, 4.28% maximum equity drawdown. Jan 2014–Oct 2026: −$1,957.14 net, −$12.71 per month, -0.013% compounded monthly, 3.48% maximum equity drawdown. Jan 2025–Oct 2026: +$494.26 net, +$22.47 per month, 0.022% compounded monthly, 1.54% 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
Exposure0.1
Metals_GoldSession010.mq5255 lines · 9.2 KB · 2026-11-29 ↓ download
View source
#property strict
#property description "Test-only broker precious-metal strategy"
const ulong LockedMagic=868433591;
const string LockedAnchor="XAUUSD";
string LegNames[]={"XAUUSD"},MapNames[]={"XAUUSD"},MapSymbols[]={"XAUUSD"};
double LegWeights[]={1.0};
double Member0(const string sym,const datetime hour)
{
   if(sym!="XAUUSD") return 0;
   MqlDateTime tm; TimeToStruct(hour,tm);
   return (tm.hour>=1 && tm.hour<7) ? 1.0*1.0 : 0;
}

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 = 0.1;
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;
   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_GoldSession010_monthly_equity.csv latestMonth-end marked equity by independent MT5 account. A partial month is identified by its observed broker timestamps.67.4 KB09c354690c6882026-11-29 01:23
BACKTESTMetals_GoldSession010_holdfee.html latestMT5 Strategy Tester, USD 100,000 initial capital. 495 closed trades. Native net P&L includes −$56.90 commission and +$0.00 swap. MT5 history quality: 100% real ticks. Rejected requests: 0.568.8 KB0d50406a0b17c2026-11-29 01:22
BACKTESTMetals_GoldSession010_fullfee.html latestMT5 Strategy Tester, USD 100,000 initial capital. 3,378 closed trades. Native net P&L includes −$413.79 commission and −$5.28 swap. MT5 history quality: 61% real ticks. Rejected requests: 0.3.1 MB05b30995e67342026-11-29 01:22
BACKTESTMetals_GoldSession010_continuousfee.html latestMT5 Strategy Tester, USD 100,000 initial capital. 4,711 closed trades. Native net P&L includes −$592.42 commission and −$5.28 swap. MT5 history quality: 43% real ticks. Rejected requests: 0.4.3 MB01434eb9090512026-11-29 01:22
BACKTESTMetals_GoldSession010_inceptionfee.html latestMT5 Strategy Tester, USD 100,000 initial capital. 5,933 closed trades. Native net P&L includes −$766.81 commission and −$20.45 swap. MT5 history quality: 35% real ticks. Rejected requests: 0.5.4 MB0cb7699961ba42026-11-29 01:22
PARAMSMetals_GoldSession010.set latestStrategy MT5 Strategy Tester preset. Exposure 0.1×.94 B0d990751afe392026-11-29 01:22
SOURCEMetals_GoldSession010.mq5 latestStrategy MQL5 source. Trade rules and sizing are preserved. The optional equity log uses a public identifier.9.2 KB02fba85f8fd992026-11-29 01:22

Related session research: Gold Friday morning long, Gold Friday afternoon short and Gold Friday and month-turn sessions.

MORE METALS STRATEGIES

all Metals →