GBPUSD Friday morning short
ResearchTargets a short GBPUSD position on Fridays from broker hour 07 through the 12:00 exit. MT5 results with booked exit commission.
EQUITY · BALANCE (USD)
FX_GBPUSD_Friday150 · GBPUSD H1 · quality 100% real ticks · drag to zoom, double-click to resetMONTHLY RETURNS
% of balance at month start| Year | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | Year |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2014 | 0.8% | -0.0% | -0.3% | 0.6% | 0.9% | 0.3% | 0.4% | 0.5% | 1.5% | 0.1% | 0.6% | -0.1% | +5.4% |
| 2015 | 0.2% | 0.6% | 0.3% | -0.6% | 2.6% | 0.8% | -0.5% | 0.4% | 0.0% | 0.5% | 1.0% | 0.1% | +5.4% |
| 2016 | 0.8% | 0.2% | -0.6% | 0.3% | 0.3% | -0.2% | 1.4% | 0.1% | 1.9% | 1.2% | -1.6% | 0.1% | +4.0% |
| 2017 | 0.6% | 2.1% | 0.7% | 0.2% | -0.1% | -0.6% | 0.2% | -0.0% | -2.1% | -0.3% | -0.2% | 0.1% | +0.4% |
| 2018 | -1.1% | 2.0% | -0.9% | 0.9% | 0.1% | -1.4% | 0.6% | 0.6% | 0.1% | -0.2% | 0.5% | 0.3% | +1.5% |
| 2019 | -0.6% | 0.5% | -0.2% | -0.0% | 0.5% | 0.3% | 0.6% | 0.3% | 0.3% | -1.7% | 0.7% | 0.2% | +0.8% |
| 2020 | 1.6% | -0.4% | -0.7% | 1.4% | 1.0% | 0.6% | -0.4% | 0.7% | 0.2% | -1.6% | 0.3% | 1.6% | +4.4% |
| 2021 | 0.4% | 0.1% | 1.4% | -0.3% | -0.5% | 0.1% | 0.1% | 0.3% | 0.3% | -1.6% | 0.6% | 1.0% | +1.8% |
| 2022 | 0.5% | 0.1% | 0.9% | 0.9% | 0.5% | 0.3% | 1.0% | 1.2% | 3.9% | 1.9% | -0.3% | -0.7% | +10.5% |
| 2023 | 1.2% | -0.1% | 0.1% | 1.0% | -1.2% | -0.3% | -0.5% | -0.2% | 0.1% | 0.2% | -0.6% | -0.5% | -0.8% |
| 2024 | 0.4% | -0.4% | -0.1% | 0.3% | -0.6% | 0.4% | -0.7% | -0.5% | 0.3% | -1.0% | 0.5% | -0.5% | -1.8% |
| 2025 | -0.3% | -0.6% | -0.3% | -0.4% | -0.2% | 0.1% | 0.4% | 0.3% | 0.4% | 0.8% | 0.6% | 0.4% | +1.2% |
| 2026 | -0.6% | -0.3% | 1.9% | -1.0% | -0.4% | -1.0% | 0.9% | -0.3% | 0.3% | -0.4% | · | · | -0.9% |
TRADE STATS
| Gross profit | 142,524.22 | Gross loss | -106,486.94 |
| Expected payoff | 24.33 | Total deals | 2585 |
| Long trades | 0 (0.0%) | Short trades | 1481 (44.2%) |
| Largest win | 3,769.14 | Largest loss | -2,172.85 |
| Average win | 217.59 | Average loss | -128.92 |
| Max consec. wins | 13 | Max consec. losses | 15 |
| Balance DD max | 9,251.62 (6.5%) | Equity DD max | 9,716.00 (6.8%) |
| Leverage | 1:100 | Broker | afx Markets Ltd |
All report fields (46)
| History Quality | 100% real ticks |
| Bars | 79696 |
| Ticks | 455173756 |
| Symbols | 1 |
| Total Net Profit | 36 037.28 |
| Balance Drawdown Absolute | 412.85 |
| Equity Drawdown Absolute | 566.82 |
| Gross Profit | 142 524.22 |
| Balance Drawdown Maximal | 9 251.62 (6.50%) |
| Equity Drawdown Maximal | 9 716.00 (6.81%) |
| Gross Loss | -106 486.94 |
| Balance Drawdown Relative | 6.50% (9 251.62) |
| Equity Drawdown Relative | 6.81% (9 716.00) |
| Profit Factor | 1.34 |
| Expected Payoff | 24.33 |
| Margin Level | 6494.55% |
| Recovery Factor | 3.71 |
| Sharpe Ratio | 3.19 |
| Z-Score | -7.59 (99.74%) |
| AHPR | 1.0002 (0.02%) |
| LR Correlation | 0.95 |
| OnTester result | 136037.28 |
| GHPR | 1.0002 (0.02%) |
| LR Standard Error | 3 751.59 |
| Total Trades | 1481 |
| Short Trades (won %) | 1481 (44.23%) |
| Long Trades (won %) | 0 (0.00%) |
| Total Deals | 2585 |
| Profit Trades (% of total) | 655 (44.23%) |
| Loss Trades (% of total) | 826 (55.77%) |
| Largest profit trade | 3 769.14 |
| Largest loss trade | -2 172.85 |
| Average profit trade | 217.59 |
| Average loss trade | -128.92 |
| Maximum consecutive wins ($) | 13 (3 300.41) |
| Maximum consecutive losses ($) | 15 (-2 070.54) |
| Maximal consecutive profit (count) | 4 649.41 (6) |
| Maximal consecutive loss (count) | -3 609.67 (7) |
| Average consecutive wins | 2 |
| Average consecutive losses | 3 |
| Correlation (Profits,MFE) | 0.67 |
| Correlation (Profits,MAE) | 0.48 |
| Correlation (MFE,MAE) | -0.1474 |
| Minimal position holding time | 0:59:59 |
| Maximal position holding time | 5:00:30 |
| Average position holding time | 4:02:01 |
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.
PARAMETERS
↓ FX_GBPUSD_Friday150.set| Input | Value | Optimise (start / step / stop) | Section |
|---|---|---|---|
| TesterOnly | true | ||
| AuditToken | 0 | ||
| Exposure | 1.5 |
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| Type | File | Notes | Size | DL | SHA-256 | Uploaded |
|---|---|---|---|---|---|---|
| FILE | MT5_monthly_marked_equity.csv latest | Native 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 KB | 0 | b683aedfa880 | 2026-11-29 08:14 |
| BACKTEST | FX_GBPUSD_Friday1600_GBPUSD_2008-01-01_2026-11-01_continuousfee_MT5.html latest | real-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 MB | 0 | 0a5d4b3c6dca | 2026-11-29 08:14 |
| BACKTEST | FX_GBPUSD_Friday1200_GBPUSD_2014-01-01_2026-11-01_fullfee_MT5.html latest | real-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 MB | 0 | 2318561357a5 | 2026-11-29 08:14 |
| BACKTEST | FX_GBPUSD_Friday150_GBPUSD_2014-01-01_2026-11-01_fullfee_MT5.html latest | real-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 KB | 0 | 7c41c1d5c94c | 2026-11-29 08:14 |
| BACKTEST | FX_GBPUSD_Friday1200_GBPUSD_2008-01-01_2026-11-01_continuousfee_MT5.html latest | real-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 MB | 0 | d76e87618366 | 2026-11-29 08:14 |
| FILE | gbpusd-friday-exit-commission-replay.csv latest | Separate 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 KB | 0 | 035be5afe40d | 2026-11-29 01:24 |
| BACKTEST | FX_GBPUSD_Friday1200_GBPUSD_2025-01-01_to_2026-11-01_holdfee.html latest | FX_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 KB | 0 | 574608450d6a | 2026-11-29 01:23 |
| BACKTEST | FX_GBPUSD_Friday150_GBPUSD_2025-01-01_to_2026-11-01_holdfee.html latest | FX_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 KB | 0 | 37461fefb503 | 2026-11-29 01:23 |
| BACKTEST | FX_GBPUSD_Friday150_GBPUSD_2008-01-01_to_2026-11-01_continuousfee.html latest | FX_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 KB | 0 | 941b1bfac3ce | 2026-11-29 01:23 |
| FILE | gbpusd-friday-test-windows.csv latest | All 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 KB | 0 | c9608907559b | 2026-11-29 01:23 |
| FILE | gbpusd-friday-additional-implementations.zip latest | Additional 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 KB | 0 | 31985c287019 | 2026-11-29 01:23 |
| PARAMS | FX_GBPUSD_Friday150.set latest | Test inputs from the matching source. The public preset uses tester mode and a neutral journal token where supported. | 92 B | 0 | 406ffe0721f0 | 2026-11-29 01:23 |
| SOURCE | FX_GBPUSD_Friday150.mq5 latest | Original MQL5 source, matched to the frozen SHA-256. | 21.0 KB | 0 | d86ca92a39b9 | 2026-11-29 01:22 |
Related session research: Gold Friday morning long, Gold Friday afternoon short and Gold Friday and month-turn sessions.