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

1 of 7
NET PROFIT · USD
+831,901
from 100,000 USD
RETURN
+831.9%
CAGR
+12.6%
18.8 yrs
PROFIT FACTOR
1.18
SHARPE
2.11
MAX DD
-56.4%
equity, relative
RECOVERY
1.27
TRADES
4797
39.8% win

EQUITY · BALANCE (USD)

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

MONTHLY RETURNS

% of balance at month start
YearJanFebMarAprMayJunJulAugSepOctNovDecYear
2008-1.9%7.1%0.3%-11.2%-4.8%-4.7%-6.3%11.6%-5.6%12.3%-9.2%17.2%+0.2%
2009-7.6%-3.9%16.3%-0.6%-18.6%-5.2%22.2%-12.4%-2.1%21.0%4.3%-4.0%+0.4%
201013.0%11.4%-10.9%-3.7%-1.0%18.0%-2.8%5.9%-3.7%-10.6%-1.7%4.2%+14.6%
2011-8.9%11.6%-0.3%-3.6%-3.2%-5.5%8.3%-1.5%-1.7%-16.8%-4.5%-13.5%-35.5%
20124.7%-8.2%-0.6%-7.3%-3.0%8.3%-5.2%-2.9%1.5%-3.5%13.9%4.2%-0.6%
20137.8%-1.1%3.6%-1.8%2.2%13.8%3.9%3.8%1.9%10.6%6.3%-2.9%+58.3%
20145.7%-0.6%-2.4%4.4%7.3%2.0%3.0%4.3%12.5%0.9%4.8%-0.5%+48.9%
20151.4%5.0%2.0%-5.1%22.1%6.1%-4.6%3.1%0.2%3.7%7.8%0.8%+48.4%
20166.5%1.4%-4.8%1.9%2.4%-4.8%10.8%1.3%16.0%9.4%-12.1%0.1%+27.8%
20174.4%17.4%5.4%1.7%-1.4%-5.1%1.2%-0.2%-15.9%-2.7%-1.9%0.6%+0.0%
2018-8.8%16.8%-7.3%7.2%0.7%-10.5%4.4%5.0%0.5%-1.6%3.8%1.7%+9.1%
2019-4.8%3.9%-1.6%-0.1%3.4%2.4%4.7%2.5%1.5%-13.3%5.6%1.5%+4.4%
202013.6%-3.2%-7.0%11.6%8.4%4.8%-3.4%5.1%1.0%-12.5%1.8%13.3%+34.4%
20212.9%0.3%11.2%-2.6%-3.7%0.7%0.7%2.3%1.9%-12.3%4.7%8.1%+13.1%
20224.2%0.7%6.9%6.9%3.6%2.2%7.5%9.9%33.4%15.0%-2.8%-5.9%+110.6%
20239.9%-1.1%0.5%8.6%-9.2%-2.5%-4.0%-1.7%0.7%1.3%-5.0%-4.4%-8.3%
20243.2%-3.4%-0.9%2.6%-4.7%3.1%-5.2%-4.0%2.1%-7.7%4.0%-4.1%-14.8%
2025-2.6%-4.5%-2.7%-3.8%-1.5%0.9%3.0%2.1%3.1%6.2%4.7%3.0%+7.5%
2026-4.5%-2.5%15.9%-7.7%-2.8%-7.8%7.2%-2.6%2.0%-3.1%··-7.8%

TRADE STATS

Gross profit5,565,028.14Gross loss-4,733,127.13
Expected payoff173.42Total deals7719
Long trades0 (0.0%)Short trades4797 (39.8%)
Largest win194,209.24Largest loss-73,682.92
Average win2,912.10Average loss-1,640.03
Max consec. wins19Max consec. losses28
Balance DD max625,071.33 (53.0%)Equity DD max656,257.15 (56.4%)
Leverage1:100Brokerafx Markets Ltd
All report fields (46)
History Quality78% real ticks
Bars116760
Ticks536256054
Symbols1
Total Net Profit831 901.01
Balance Drawdown Absolute38 029.89
Equity Drawdown Absolute40 191.31
Gross Profit5 565 028.14
Balance Drawdown Maximal625 071.33 (43.80%)
Equity Drawdown Maximal656 257.15 (45.31%)
Gross Loss-4 733 127.13
Balance Drawdown Relative53.05% (70 019.02)
Equity Drawdown Relative56.38% (77 291.05)
Profit Factor1.18
Expected Payoff173.42
Margin Level640.18%
Recovery Factor1.27
Sharpe Ratio2.11
Z-Score-25.99 (99.74%)
AHPR1.0006 (0.06%)
LR Correlation0.89
OnTester result931901.0100000007
GHPR1.0005 (0.05%)
LR Standard Error172 417.05
Total Trades4797
Short Trades (won %)4797 (39.84%)
Long Trades (won %)0 (0.00%)
Total Deals7719
Profit Trades (% of total)1911 (39.84%)
Loss Trades (% of total)2886 (60.16%)
Largest profit trade194 209.24
Largest loss trade-73 682.92
Average profit trade2 912.10
Average loss trade-1 640.03
Maximum consecutive wins ($)19 (18 222.41)
Maximum consecutive losses ($)28 (-14 673.20)
Maximal consecutive profit (count)252 120.64 (7)
Maximal consecutive loss (count)-131 713.00 (21)
Average consecutive wins3
Average consecutive losses4
Correlation (Profits,MFE)0.60
Correlation (Profits,MAE)0.39
Correlation (MFE,MAE)-0.3550
Minimal position holding time0:59:23
Maximal position holding time5:24:30
Average position holding time3:20:48

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 →