OPENSTRATS

GBPUSD Friday morning short

Research

Targets a short GBPUSD position on Fridays from broker hour 07 through the 12:00 exit. MT5 results with booked exit commission.

SYM GBPUSDTF H1TEST 2008-01-01 → 2026-10-31UPDATED VIEWS 0DOWNLOADS 0#session-calendar

BACKTESTS · 7

3 of 7
NET PROFIT · USD
+1,267,470
from 100,000 USD
RETURN
+1267.5%
CAGR
+14.9%
18.8 yrs
PROFIT FACTOR
1.14
SHARPE
1.86
MAX DD
-68.1%
equity, relative
RECOVERY
0.89
TRADES
4824
39.9% win

EQUITY · BALANCE (USD)

FX_GBPUSD_Friday1600 · GBPUSD H1 · quality 78% real ticks · drag to zoom, double-click to reset

MONTHLY RETURNS

% of balance at month start
YearJanFebMarAprMayJunJulAugSepOctNovDecYear
2008-2.8%9.5%0.3%-14.8%-6.5%-6.2%-8.4%15.4%-7.6%15.0%-12.9%23.1%-3.9%
2009-10.5%-5.5%21.5%-1.0%-24.4%-7.1%30.2%-16.3%-3.0%27.9%5.5%-5.4%-3.7%
201017.4%15.3%-14.4%-5.0%-2.3%24.3%-4.0%7.8%-5.1%-14.0%-2.5%5.4%+16.2%
2011-11.7%15.7%-0.6%-4.8%-4.3%-7.5%11.2%-2.2%-2.5%-21.9%-6.0%-17.7%-45.3%
20126.3%-10.9%-1.0%-9.7%-4.1%10.9%-7.0%-4.0%1.9%-4.6%18.8%5.5%-2.0%
201310.6%-1.6%4.5%-2.4%2.8%18.7%5.2%5.0%2.5%14.3%8.4%-3.9%+82.3%
20147.3%-0.8%-3.2%5.8%9.8%2.6%4.0%5.7%16.8%1.1%6.3%-0.8%+68.2%
20151.8%6.6%2.5%-6.9%30.2%8.2%-6.2%4.1%0.2%4.9%10.4%1.0%+67.1%
20168.6%1.8%-6.4%2.3%3.1%-8.1%14.3%1.6%21.7%12.2%-16.0%-0.0%+33.4%
20175.7%23.6%7.1%2.1%-1.9%-6.9%1.5%-0.3%-20.9%-3.7%-2.6%0.7%-1.4%
2018-11.7%22.8%-9.7%9.6%0.9%-13.9%5.8%6.6%0.5%-2.2%5.0%2.1%+10.7%
2019-6.5%5.2%-2.4%-0.2%4.5%3.2%6.3%3.3%1.8%-17.4%7.4%1.9%+4.5%
202018.4%-4.4%-10.1%15.5%11.2%6.2%-4.5%6.8%1.2%-16.5%2.4%17.8%+44.3%
20213.8%0.3%15.1%-3.5%-5.0%0.8%0.8%3.1%2.5%-16.1%6.2%10.9%+16.7%
20225.6%0.9%9.3%9.0%4.6%2.9%9.8%13.3%45.6%20.2%-3.9%-8.0%+162.8%
202313.2%-1.5%0.4%11.5%-12.2%-3.3%-5.4%-2.3%0.8%1.6%-6.7%-6.0%-12.1%
20244.2%-4.5%-1.2%3.4%-6.2%4.1%-7.0%-5.3%2.7%-10.2%5.3%-5.5%-19.8%
2025-3.6%-6.0%-3.7%-5.2%-2.0%1.1%4.0%2.7%4.1%8.3%6.3%4.0%+9.1%
2026-6.0%-3.3%21.5%-10.2%-3.8%-10.2%9.7%-3.5%2.6%-4.0%··-10.6%

TRADE STATS

Gross profit10,093,335.64Gross loss-8,825,865.52
Expected payoff262.74Total deals7762
Long trades0 (0.0%)Short trades4824 (39.9%)
Largest win386,483.40Largest loss-161,084.50
Average win5,243.29Average loss-3,044.45
Max consec. wins19Max consec. losses30
Balance DD max1,352,091.86 (64.8%)Equity DD max1,420,310.36 (68.1%)
Leverage1:100Brokerafx Markets Ltd
All report fields (46)
History Quality78% real ticks
Bars116760
Ticks536256054
Symbols1
Total Net Profit1 267 470.12
Balance Drawdown Absolute54 259.28
Equity Drawdown Absolute56 380.91
Gross Profit10 093 335.64
Balance Drawdown Maximal1 352 091.86 (54.50%)
Equity Drawdown Maximal1 420 310.36 (56.14%)
Gross Loss-8 825 865.52
Balance Drawdown Relative64.79% (84 162.42)
Equity Drawdown Relative68.09% (93 088.30)
Profit Factor1.14
Expected Payoff262.74
Margin Level432.67%
Recovery Factor0.89
Sharpe Ratio1.86
Z-Score-26.28 (99.74%)
AHPR1.0008 (0.08%)
LR Correlation0.85
OnTester result1367470.120000002
GHPR1.0005 (0.05%)
LR Standard Error332 211.32
Total Trades4824
Short Trades (won %)4824 (39.90%)
Long Trades (won %)0 (0.00%)
Total Deals7762
Profit Trades (% of total)1925 (39.90%)
Loss Trades (% of total)2899 (60.10%)
Largest profit trade386 483.40
Largest loss trade-161 084.50
Average profit trade5 243.29
Average loss trade-3 044.45
Maximum consecutive wins ($)19 (26 694.65)
Maximum consecutive losses ($)30 (-17 897.77)
Maximal consecutive profit (count)511 364.52 (7)
Maximal consecutive loss (count)-301 730.44 (21)
Average consecutive wins3
Average consecutive losses4
Correlation (Profits,MFE)0.59
Correlation (Profits,MAE)0.38
Correlation (MFE,MAE)-0.3804
Minimal position holding time0:59:23
Maximal position holding time5:24:30
Average position holding time3:20:29

NOTES

Targets a short GBPUSD position on Fridays from broker hour 07 through the 12:00 exit. The main version uses 1.50× notional. The accompanying variants use 2.00×, 12.00× and 16.00×.

GBPUSD_Friday150, Jan 2008–Oct 2026. MT5 booked +$44,051.17 on $100,000, +0.162% compounded monthly, with 9.02% maximum relative equity drawdown.

GBPUSD_Friday150, Jan 2025–Oct 2026. MT5 booked +$293.71 on $100,000, +0.013% compounded monthly, with 2.44% maximum relative equity drawdown.

At 12.00× the fresh January 2025 test lost $885.00 and recorded 18.30% maximum equity drawdown.

InputValueOptimise (start / step / stop)Section
TesterOnlytrue
AuditToken0
Exposure1.5
FX_GBPUSD_Friday150.mq5560 lines · 21.0 KB · 2026-11-29 ↓ download
View source
#property strict
#property version "1.00"
const ulong LockedMagic=21074958088624;
const string LockedAnchor="GBPUSD";
string LegNames[]={"GBPUSD"};
double LegWeights[]={1.0};
string DSUniverse[]={"AUDUSD","EURUSD","GBPUSD","NZDUSD","USDCAD","USDCHF","USDJPY"};
string MapNames[]={"EURUSD","GBPUSD","AUDUSD","NZDUSD","USDJPY","USDCHF","USDCAD"};
string MapSymbols[]={"EURUSD","GBPUSD","AUDUSD","NZDUSD","USDJPY","USDCHF","USDCAD"};
datetime MapFirstH1[]={1388610000,1388610000,1388610000,1388610000,1388610000,1388610000,1388610000};
datetime DSFirstH1(const string broker) { for(int j=0;j<ArraySize(MapSymbols);j++) if(MapSymbols[j]==broker) return MapFirstH1[j]; return 0; }
string DSBrokerSymbol(const string canonical);
// Native broker-time H1 rules. Called at a new H1 open; all referenced prices
// come from completed H1 bars except explicit opening quotes for entry presence.
#ifndef DEEP_INTRADAY_SIGNALS_MQH
#define DEEP_INTRADAY_SIGNALS_MQH

bool IRRead(const string sym,const datetime start,MqlRates &bar)
{
   MqlRates a[1];
   if(CopyRates(sym,PERIOD_H1,start,1,a)!=1 || a[0].time!=start) return false;
   bar=a[0];
   return bar.open>0;
}
bool IRHasOpen(const string sym,const datetime day,const int hour)
{
   MqlRates x;
   return IRRead(sym,day+3600*hour,x);
}
bool IRRange(const string sym,const datetime day,const int begin,const int end,
             double &hi,double &lo,double &move)
{
   MqlRates a[];
   const int n=CopyRates(sym,PERIOD_H1,day+3600*begin,day+3600*end-1,a);
   if(n!=end-begin || n<=0) return false;
   hi=a[0].high; lo=a[0].low;
   for(int i=0;i<n;i++)
   {
      if(a[i].time!=day+3600*(begin+i) || a[i].low<=0 || a[i].close<=0) return false;
      hi=MathMax(hi,a[i].high); lo=MathMin(lo,a[i].low);
   }
   move=a[n-1].close-a[0].open;
   return hi>lo;
}
int IRRegion(const string region,const string currency)
{
   string list=region=="asia" ? "|AUD|NZD|JPY|" : region=="europe" ? "|EUR|GBP|CHF|" : "|USD|CAD|";
   return StringFind(list,"|"+currency+"|")>=0 ? 1 : 0;
}
int IRSgn(const double a) {return a>0 ? 1 : a<0 ? -1 : 0;}

bool IRCalendar(const string &part[],const string sym,const datetime day,const int hour,int &side)
{
   const int n=ArraySize(part);
   const int enter=(int)StringToInteger(part[n-4]), end=(int)StringToInteger(part[n-3]);
   if(hour<enter || hour>=end || !IRHasOpen(sym,day,enter)) return true;
   MqlDateTime clock; TimeToStruct(day,clock);
   bool use=false;
   if(part[1]=="monday") use=clock.day_of_week==1;
   if(part[1]=="friday") use=clock.day_of_week==5;
   if(part[1]=="month" && clock.day_of_week>0 && clock.day_of_week<6)
   {
      int count=1;
      const int step=part[2]=="first2" ? -1 : 1;
      for(int i=1;i<=5;i++)
      {
         MqlDateTime d; TimeToStruct(day+step*i*86400,d);
         if(d.mon!=clock.mon) break;
         if(d.day_of_week>0 && d.day_of_week<6) count++;
         if(count>2) break;
      }
      use=count<=2;
   }
   if(use)
   {
      string base=SymbolInfoString(sym,SYMBOL_CURRENCY_BASE),quote=SymbolInfoString(sym,SYMBOL_CURRENCY_PROFIT);
      side=(base=="USD" ? 1 : quote=="USD" ? -1 : 0)*(part[n-1]=="up" ? 1 : -1);
   }
   return true;
}

bool IRHistory(const string sym,const datetime at,const int n,MqlRates &bars[])
{
   return CopyRates(sym,PERIOD_H1,(datetime)(at-1),n,bars)==n && bars[n-1].time<at;
}
double IRMedian(double &values[])
{
   ArraySort(values);
   const int n=ArraySize(values);
   return n%2==1 ? values[n/2] : 0.5*(values[n/2-1]+values[n/2]);
}
bool IRIsSqueeze(const string sym,const datetime day)
{
   double ranges[13];int n=0;
   // Sparse/reopened sessions need 12 observed hourly bars to qualify as one day.
   // Extend back to the start of available data if market closures are unusually long.
   const datetime earliest=(datetime)SeriesInfoInteger(sym,PERIOD_H1,SERIES_FIRSTDATE);
   if(earliest<=0) return false;
   for(datetime end=day-1; n<13 && end>=earliest; end-=86400)
   {
      MqlRates bars[];
      int count=CopyRates(sym,PERIOD_H1,end-86399,end,bars);
      if(count<12) continue;
      double hi=bars[0].high,lo=bars[0].low;
      for(int i=1;i<count;i++) {hi=MathMax(hi,bars[i].high);lo=MathMin(lo,bars[i].low);}
      ranges[n++]=hi-lo;
   }
   if(n<8) return false;
   double reference[];ArrayResize(reference,n-1);
   for(int i=1;i<n;i++) reference[i-1]=ranges[i];
   return ranges[0]<0.85*IRMedian(reference);
}
int IRSma(const string sym,const datetime at,const int fast,const int slow)
{
   MqlRates bars[];
   if(!IRHistory(sym,at,slow,bars)) return 0;
   double f=0,s=0;
   for(int i=0;i<slow;i++) {s+=bars[i].close;if(i>=slow-fast) f+=bars[i].close;}
   f/=fast;s/=slow;
   const double close=bars[slow-1].close;
   return f>s && close>f ? 1 : f<s && close<f ? -1 : 0;
}
int IRZ(const string sym,const datetime at,const int n,const double trigger)
{
   MqlRates bars[];
   if(!IRHistory(sym,at,n+1,bars)) return 0;
   double mean=0,ss=0;
   for(int i=0;i<n;i++) mean+=bars[i].close;
   mean/=n;
   for(int i=0;i<n;i++) ss+=MathPow(bars[i].close-mean,2);
   if(ss<=0) return 0;
   const double z=(bars[n].close-mean)/MathSqrt(ss/n);
   return z>=trigger ? 1 : z<=-trigger ? -1 : 0;
}
int IRShock(const string sym,const datetime at,const double threshold)
{
   MqlRates bars[];if(!IRHistory(sym,at,25,bars)) return 0;
   double widths[];ArrayResize(widths,24);
   for(int i=0;i<24;i++) widths[i]=bars[i].high-bars[i].low;
   double bench=IRMedian(widths),w=bars[24].high-bars[24].low;
   if(bench<=0 || w<=0 || w/bench<threshold) return 0;
   const double x=(bars[24].close-bars[24].low)/w;
   return x>=.8 ? 1 : x<=.2 ? -1 : 0;
}
int IRSeasonal(const string sym,const datetime day,const int enter,const int end,const int weeks)
{
   MqlDateTime now;TimeToStruct(day,now);
   if(now.day_of_week==0 || now.day_of_week==6) return 0;
   double sample[];ArrayResize(sample,weeks);int count=0;
   for(int w=1;w<=weeks;w++)
   {
      datetime past=day-(datetime)(w*7*86400);
      MqlRates a,b;
      if(IRRead(sym,past+3600*enter,a) && IRRead(sym,past+3600*end,b))
         sample[count++]=MathLog(b.open/a.open);
   }
   if(count<weeks-2) return 0;
   double mean=0,ss=0;
   for(int i=0;i<count;i++) mean+=sample[i];
   mean/=count;
   for(int i=0;i<count;i++) ss+=MathPow(sample[i]-mean,2);
   const double sd=MathSqrt(ss/count);
   return mean>.15*sd ? 1 : mean<-.15*sd ? -1 : 0;
}
int IRRelative(const string sym,const datetime day,const int begin,const int end,const double gap)
{
   string currencies[]={"EUR","GBP","JPY","CHF","AUD","NZD","CAD","USD"};
   string base=SymbolInfoString(sym,SYMBOL_CURRENCY_BASE),quote=SymbolInfoString(sym,SYMBOL_CURRENCY_PROFIT);
   int pos=StringFind(sym,base+quote);if(pos<0) return 0;
   string prefix=StringSubstr(sym,0,pos),suffix=StringSubstr(sym,pos+6);
   double value[8];bool valid[8];ArrayInitialize(valid,false);int n=1;
   valid[7]=true;value[7]=0;
   for(int i=0;i<7;i++)
   {
      string name=prefix+currencies[i]+"USD"+suffix;
      bool custom=false;int sign=1;
      if(!SymbolExist(name,custom)) {name=prefix+"USD"+currencies[i]+suffix;sign=-1;}
      if(!SymbolExist(name,custom) || !SymbolSelect(name,true)) continue;
      double hi,lo,move;MqlRates a,b;
      if(IRRange(name,day,begin,end,hi,lo,move) && IRRead(name,day+3600*begin,a) && IRRead(name,day+3600*(end-1),b))
      {
         valid[i]=true;value[i]=sign*MathLog(b.close/a.open);n++;
      }
   }
   if(n<5) return 0;
   double rankb=0,rankq=0;
   for(int i=0;i<8;i++)
   {
      if(!valid[i] || (currencies[i]!=base && currencies[i]!=quote)) continue;
      int below=0,equal=0;
      for(int j=0;j<8;j++) if(valid[j])
      {if(value[j]<value[i]) below++;else if(value[j]==value[i]) equal++;}
      const double rank=(below+0.5*(equal+1))/n;
      if(currencies[i]==base) rankb=rank;
      if(currencies[i]==quote) rankq=rank;
   }
   if(rankb==0 || rankq==0) return 0;
   double diff=rankb-rankq;
   return diff>=gap ? 1 : diff<=-gap ? -1 : 0;
}

bool H1Target(const string rule,const string sym,const datetime barOpen,int &side)
{
   side=0;
   string part[];
   const int n=StringSplit(rule,'_',part);
   if(n<2) return false;
   const datetime day=(datetime)(((long)barOpen/86400)*86400);
   const int hour=(int)((barOpen-day)/3600);
   if(!SeriesInfoInteger(sym,PERIOD_H1,SERIES_SYNCHRONIZED))
   {
      // Start history synchronization on a newly selected tester symbol.
      MqlRates warm[1]; if(CopyRates(sym,PERIOD_H1,0,1,warm)!=1) return false;
   }
   if(part[0]=="region" && n==6)
   {
      const int enter=(int)StringToInteger(part[2]), end=(int)StringToInteger(part[3]);
      if(hour>=enter && hour<end && IRHasOpen(sym,day,enter))
      {
         const int local=IRRegion(part[1],SymbolInfoString(sym,SYMBOL_CURRENCY_BASE))
                        -IRRegion(part[1],SymbolInfoString(sym,SYMBOL_CURRENCY_PROFIT));
         side=local*(part[4]=="sell" ? -1 : 1);
      }
      return true;
   }
   if(part[0]=="calendar" && (n==6 || n==7))
      return IRCalendar(part,sym,day,hour,side);
   if(part[0]=="impulse" && n==7)
   {
      const int enter=(int)StringToInteger(part[3]), end=(int)StringToInteger(part[4]);
      if(hour<enter || hour>=end || !IRHasOpen(sym,day,enter)) return true;
      double hi,lo,move;
      if(IRRange(sym,day,(int)StringToInteger(part[1]),(int)StringToInteger(part[2]),hi,lo,move) &&
         MathAbs(move)>=(hi-lo)*StringToDouble(part[5])/100.0)
         side=IRSgn(move)*(part[6]=="follow" ? 1 : -1);
      return true;
   }
   if(part[0]=="range" && n==7)
   {
      const int begin=(int)StringToInteger(part[1]), end=(int)StringToInteger(part[2]);
      const int last=(int)StringToInteger(part[3]);
      if(hour<=end || hour>=last) return true;
      double hi,lo,move;
      if(!IRRange(sym,day,begin,end,hi,lo,move)) return true;
      if(part[5]=="squeeze" && !IRIsSqueeze(sym,day)) return true;
      const double mid=(hi+lo)/2;
      for(int h=end+1;h<=hour;h++)
      {
         MqlRates b;
         if(!IRHasOpen(sym,day,h) || !IRRead(sym,day+3600*(h-1),b)) continue;
         int d=0;
         if(part[4]=="break") d=b.close>hi ? 1 : b.close<lo ? -1 : 0;
         else if(b.low<lo && b.close>lo && b.close<=mid && b.high<=hi) d=1;
         else if(b.high>hi && b.close<hi && b.close>=mid && b.low>=lo) d=-1;
         if(d!=0)
         {
            if(part[6]=="session" || hour<h+StringToInteger(part[6])) side=d;
            break;
         }
      }
      return true;
   }
   if(part[0]=="sma" && n==5)
   {
      int enter=(int)StringToInteger(part[3]), last=(int)StringToInteger(part[4]);
      if(hour>=enter && hour<last && IRHasOpen(sym,day,enter))
         side=IRSma(sym,day+3600*enter,(int)StringToInteger(part[1]),(int)StringToInteger(part[2]));
      return true;
   }
   if((part[0]=="z" || part[0]=="vol") && n==6)
   {
      bool z=part[0]=="z";
      int enter=(int)StringToInteger(part[z?3:2]), last=(int)StringToInteger(part[z?4:3]);
      int holding=z ? 3 : (int)StringToInteger(part[4]);
      if(hour<enter || hour>=last) return true;
      for(int h=enter;h<=hour;h++)
      {
         if(!IRHasOpen(sym,day,h)) continue;
         datetime at=day+3600*h;
         int event=z ? IRZ(sym,at,(int)StringToInteger(part[1]),StringToDouble(part[2])/10)
                     : IRShock(sym,at,StringToDouble(part[1])/100);
         if(event!=0)
         {
            if(hour<h+holding) side=event*(part[5]=="follow" ? 1 : -1);
            break;
         }
      }
      return true;
   }
   if(part[0]=="seasonal" && n==4)
   {
      int enter=(int)StringToInteger(part[2]), end=(int)StringToInteger(part[3]);
      if(hour>=enter && hour<end && IRHasOpen(sym,day,enter))
         side=IRSeasonal(sym,day,enter,end,(int)StringToInteger(part[1]));
      return true;
   }
   if(part[0]=="relative" && n==7)
   {
      int enter=(int)StringToInteger(part[3]), end=(int)StringToInteger(part[4]);
      if(hour>=enter && hour<end && IRHasOpen(sym,day,enter))
         side=IRRelative(sym,day,(int)StringToInteger(part[1]),(int)StringToInteger(part[2]),
                         StringToDouble(part[5])/100)*(part[6]=="follow" ? 1 : -1);
      return true;
   }
   return false;
}
#endif

double Component0[]={1.0};
bool SelectedWeight(const int leg,const string sym,const datetime hour,double &weight)
{
   weight=0;
   int side=0;
   if(Component0[leg]>0)
   {
      side=0;
      if(!H1Target("calendar_friday_07_12_usd_up",sym,hour,side) || side< -1 || side>1) return false;
      weight+=side*Component0[leg];
   }
   return true;
}
// 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 AuditToken = 0; // Unique tag for the tester's monthly equity file.
input double Exposure = 1.5;
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)
{
   if(canonical=="BTCUSD" || canonical=="SOLUSD" || canonical=="ETHUSD") return true;
   if(StringLen(canonical)!=6) return false;
   const string base=StringSubstr(canonical,0,3), quote=StringSubstr(canonical,3);
   const string fx="|USD|EUR|GBP|JPY|CHF|CAD|AUD|NZD|";
   return base!=quote && StringFind(fx,"|"+base+"|")>=0 && StringFind(fx,"|"+quote+"|")>=0;
}

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(!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;
      total+=LegWeights[i];
   }
   if(total<=0 || _Symbol!=LockedAnchor) return INIT_PARAMETERS_INCORRECT;
   if(MQLInfoInteger(MQL_TESTER) && AuditToken>0)
   {
      const string fn="AFXResearch\\monthly-"+IntegerToString((long)AuditToken)+".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
FILEMT5_monthly_marked_equity.csv latestNative MT5 calendar-month equity and balance across available runs. Equity includes floating P&L. Source, symbol, date and test-window keys distinguish multiple presets and independent cash accounts.190.8 KB0b683aedfa8802026-11-29 08:14
BACKTESTFX_GBPUSD_Friday1600_GBPUSD_2008-01-01_2026-11-01_continuousfee_MT5.html latestreal-tick mode. 2008-01-01 through 2026-10-31. MT5 net $1,267,470.12 includes its recorded spread, swaps and $135,673.87 in closing commissions. Every deal and 4 original chart images are included. Orders table omitted to reduce file size.1.6 MB00a5d4b3c6dca2026-11-29 08:14
BACKTESTFX_GBPUSD_Friday1200_GBPUSD_2014-01-01_2026-11-01_fullfee_MT5.html latestreal-tick mode. 2014-01-01 through 2026-10-31. MT5 net $696,046.95 includes its recorded spread, swaps and $57,748.22 in closing commissions. Every deal and 4 original chart images are included. Orders table omitted to reduce file size.1.1 MB02318561357a52026-11-29 08:14
BACKTESTFX_GBPUSD_Friday150_GBPUSD_2014-01-01_2026-11-01_fullfee_MT5.html latestreal-tick mode. 2014-01-01 through 2026-10-31. MT5 net $36,037.28 includes its recorded spread, swaps and $1,723.81 in closing commissions. Every deal and 4 original chart images are included. Orders table omitted to reduce file size.626.0 KB07c41c1d5c94c2026-11-29 08:14
BACKTESTFX_GBPUSD_Friday1200_GBPUSD_2008-01-01_2026-11-01_continuousfee_MT5.html latestreal-tick mode. 2008-01-01 through 2026-10-31. MT5 net $831,901.01 includes its recorded spread, swaps and $72,749.88 in closing commissions. Every deal and 4 original chart images are included. Orders table omitted to reduce file size.1.6 MB0d76e876183662026-11-29 08:14
FILEgbpusd-friday-exit-commission-replay.csv latestSeparate H1 replays with the 0.0014% exit commission on net position reductions, estimated spread and slippage, and either zero financing or a 3% annual financing stress. Each window starts from $100,000. Daily historical broker swap rates are unavailable.1.6 KB0035be5afe40d2026-11-29 01:24
BACKTESTFX_GBPUSD_Friday1200_GBPUSD_2025-01-01_to_2026-11-01_holdfee.html latestFX_GBPUSD_Friday1200 on GBPUSD, Jan 2025–Oct 2026. MT5 booked −$885.03 including its 0.0014% exit commission. H1 host, MT5 real-tick mode. Includes native settings, results and every deal. Order-request rows are omitted.259.7 KB0574608450d6a2026-11-29 01:23
BACKTESTFX_GBPUSD_Friday150_GBPUSD_2025-01-01_to_2026-11-01_holdfee.html latestFX_GBPUSD_Friday150 on GBPUSD, Jan 2025–Oct 2026. MT5 booked +$293.71 including its 0.0014% exit commission. H1 host, MT5 real-tick mode. Includes native settings, results and every deal. Order-request rows are omitted.170.6 KB037461fefb5032026-11-29 01:23
BACKTESTFX_GBPUSD_Friday150_GBPUSD_2008-01-01_to_2026-11-01_continuousfee.html latestFX_GBPUSD_Friday150 on GBPUSD, Jan 2008–Oct 2026. MT5 booked +$44,051.17 including its 0.0014% exit commission. H1 host, MT5 real-tick mode. Includes native settings, results and every deal. Order-request rows are omitted.876.9 KB0941b1bfac3ce2026-11-29 01:23
FILEgbpusd-friday-test-windows.csv latestAll measured windows, separately reported by source, size, instrument, tick model and commission treatment. Native P&L and fixed-fill fee estimates have separate columns.8.5 KB0c9608907559b2026-11-29 01:23
FILEgbpusd-friday-additional-implementations.zip latestAdditional original MQL5 source files and corresponding tester presets for FX_GBPUSD_Friday, FX_GBPUSD_Friday1200, FX_GBPUSD_Friday1600. Each variant’s evidence basis appears in the window CSV.20.3 KB031985c2870192026-11-29 01:23
PARAMSFX_GBPUSD_Friday150.set latestTest inputs from the matching source. The public preset uses tester mode and a neutral journal token where supported.92 B0406ffe0721f02026-11-29 01:23
SOURCEFX_GBPUSD_Friday150.mq5 latestOriginal MQL5 source, matched to the frozen SHA-256.21.0 KB0d86ca92a39b92026-11-29 01:22

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

MORE FX STRATEGIES

all FX →