BTC, ETH and SOL 30-day rotation
ResearchAn MT5 research EA that rotates a 10% allocation into the strongest of BTC, ETH and SOL when 30-day momentum is positive.
EQUITY · BALANCE (USD)
Crypto_Rotation · BTCUSD 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2025 | 1.1% | -2.5% | · | 1.1% | 1.8% | -0.8% | 3.5% | 1.2% | -0.6% | -0.9% | · | 0.1% | +3.8% |
| 2026 | -2.5% | · | -0.6% | 1.0% | -0.7% | · | -0.3% | 2.8% | 0.8% | -0.3% | · | · | +0.1% |
TRADE STATS
| Gross profit | 26,743.35 | Gross loss | -22,862.59 |
| Expected payoff | 0.66 | Total deals | 8782 |
| Long trades | 5859 (51.2%) | Short trades | 0 (0.0%) |
| Largest win | 1,697.65 | Largest loss | -1,059.91 |
| Average win | 8.91 | Average loss | -8.00 |
| Max consec. wins | 255 | Max consec. losses | 306 |
| Balance DD max | 5,965.31 (5.6%) | Equity DD max | 6,775.10 (6.3%) |
| Leverage | 1:100 | Broker | afx Markets Ltd |
All report fields (46)
| History Quality | 100% real ticks |
| Bars | 13198 |
| Ticks | 111534378 |
| Symbols | 3 |
| Total Net Profit | 3 880.76 |
| Balance Drawdown Absolute | 1 579.57 |
| Equity Drawdown Absolute | 1 719.98 |
| Gross Profit | 26 743.35 |
| Balance Drawdown Maximal | 5 965.31 (5.61%) |
| Equity Drawdown Maximal | 6 775.10 (6.34%) |
| Gross Loss | -22 862.59 |
| Balance Drawdown Relative | 5.61% (5 965.31) |
| Equity Drawdown Relative | 6.34% (6 775.10) |
| Profit Factor | 1.17 |
| Expected Payoff | 0.66 |
| Margin Level | 97852.70% |
| Recovery Factor | 0.57 |
| Sharpe Ratio | 0.49 |
| Z-Score | -64.09 (99.74%) |
| AHPR | 1.0000 (0.00%) |
| LR Correlation | 0.26 |
| OnTester result | 103880.76 |
| GHPR | 1.0000 (0.00%) |
| LR Standard Error | 1 840.71 |
| Total Trades | 5859 |
| Short Trades (won %) | 0 (0.00%) |
| Long Trades (won %) | 5859 (51.24%) |
| Total Deals | 8782 |
| Profit Trades (% of total) | 3002 (51.24%) |
| Loss Trades (% of total) | 2857 (48.76%) |
| Largest profit trade | 1 697.65 |
| Largest loss trade | -1 059.91 |
| Average profit trade | 8.91 |
| Average loss trade | -8.00 |
| Maximum consecutive wins ($) | 255 (1 473.56) |
| Maximum consecutive losses ($) | 306 (-961.87) |
| Maximal consecutive profit (count) | 3 070.86 (105) |
| Maximal consecutive loss (count) | -1 949.45 (13) |
| Average consecutive wins | 13 |
| Average consecutive losses | 12 |
| Correlation (Profits,MFE) | 0.71 |
| Correlation (Profits,MAE) | 0.34 |
| Correlation (MFE,MAE) | -0.3204 |
| Minimal position holding time | 0:00:27 |
| Maximal position holding time | 506:23:30 |
| Average position holding time | 87:49:29 |
NOTES
Trading rule
Each broker day the EA compares the latest completed daily close with the close 30 bars earlier for BTCUSD, ETHUSD and SOLUSD. It selects the strongest positive return and targets a long position worth 10% of account equity. It holds cash when no coin qualifies. Position size is recalculated on eligible hourly quotes.
Backtest results
Each test started with USD 100,000. Results include spread, financing and a 0.0014% commission on closing volume.
- July 2021–October 2026 earned $50,210.70 across 64 months. Compounded monthly return was 0.638%, with 6.84% maximum equity drawdown.
- January 2025–October 2026 earned $3,880.76 across 22 months. Compounded monthly return was 0.173%, with 6.34% maximum equity drawdown. This test restarted with fresh capital and overlaps the long test.
- November 1–26, 2026 stayed in cash and finished flat.
In the long test, $12,753.68 of net profit came from SOL trades before the broker’s recorded SOL tick history began on December 2, 2022. MT5 generated ticks for those earlier SOL trades. The monthly equity CSV includes flat months and values open positions at month end. The platform’s balance charts are based on deals.
Running the test
Compile Crypto_Rotation.mq5 in MetaEditor and load Crypto_Rotation.set in MT5 Strategy Tester. Use BTCUSD H1 as the host chart, USD as the deposit currency and the every-tick model based on real ticks. All three symbols must be available. This build runs only in Strategy Tester. The 10% input sets target exposure.
PARAMETERS
↓ Crypto_Rotation.set| Input | Value | Optimise (start / step / stop) | Section |
|---|---|---|---|
| TesterOnly | true | ||
| AuditToken | 0 | ||
| Exposure | 0.1 |
View source
#property strict
#property version "1.00"
// AFX historical research only. Frozen coin-contract sizing, instrument universe and rule.
const ulong LockedMagic=209416941002;
const string LockedAnchor="BTCUSD";
string LegNames[]={"BTCUSD","ETHUSD","SOLUSD"};
double LegWeights[]={1.0,1.0,1.0};
string MapNames[]={"BTCUSD","ETHUSD","SOLUSD"};
string MapSymbols[]={"BTCUSD","ETHUSD","SOLUSD"};
// Last complete prior calendar day must be present for every coin. Reported
// daily close-to-close lookback is counted on each symbol's own broker bars.
datetime rotationDay=0;
int rotationWinner=-1;
bool SelectedWeight(const int leg,const string sym,const datetime hour,double &weight)
{
const datetime day=(datetime)(((long)hour/86400)*86400);
if(day!=rotationDay)
{
int winner=-1; double best=0;
for(int j=0;j<ArraySize(LegNames);j++)
{
MqlRates r[];
const int n=CopyRates(LegNames[j],PERIOD_D1,day-1,31,r);
if(n<0) return false;
if(n!=31 || r[30].time!=day-86400 || r[0].close<=0)
{
winner=-1;
break;
}
const double score=r[30].close/r[0].close-1.0;
if(score>best) { best=score; winner=j; }
}
rotationWinner=winner; rotationDay=day;
}
weight=leg==rotationWinner?1.0:0.0;
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;
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)
{
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) || !TesterOnly || AccountInfoString(ACCOUNT_CURRENCY)!="USD" || _Period!=PERIOD_H1) || 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 | Crypto_Rotation_2026-11_flat_equity_marks.csv latest | Native equity recorder for November 1–26, 2026. The balance and equity remained at 100,000 USD throughout the observed window. There were no trades to plot in the website’s deal-based curve. | 159 B | 0 | d25df79dc3dd | 2026-11-29 08:19 |
| BACKTEST | Crypto_Rotation_2021-07_to_2026-10.html latest | Full MT5 report, 64 months. Early SOL history includes generated ticks. | 14.4 MB | 0 | 165904aa9e82 | 2026-11-29 01:14 |
| BACKTEST | Crypto_Rotation_2026-11-01_to_2026-11-26.html latest | Separate 26-day test. The EA held cash throughout. | 40.0 KB | 0 | 0ba9b208b3ed | 2026-11-29 01:14 |
| BACKTEST | Crypto_Rotation_2025-01_to_2026-10.html latest | Independent restart with USD 100,000 over the final 22 months of the long sample. | 4.1 MB | 0 | b70c160a612e | 2026-11-29 01:14 |
| FILE | Crypto_Rotation_monthly_equity.csv latest | Monthly marked-to-market equity and profit, including months without deals. | 5.5 KB | 0 | ea11b668b971 | 2026-11-29 01:14 |
| PARAMS | Crypto_Rotation.set latest | Tested inputs at 10% target exposure. | 92 B | 1 | 11cc4dd5a909 | 2026-11-29 01:14 |
| SOURCE | Crypto_Rotation.mq5 latest | MT5 Strategy Tester EA source. | 10.1 KB | 0 | 25f31c539a1a | 2026-11-29 01:14 |