OPENSTRATS

BTC and ETH 30-day rotation at 0.60×

Research

Jun 2018–Oct 2026 MT5 results showed +$167,912.44 net and 65.31% maximum equity drawdown.

SYM BTCUSD, ETHUSDTF H1TEST 2018-06-01 → 2026-10-31UPDATED VIEWS 0DOWNLOADS 0#trend

BACKTESTS · 2

1 of 2
NET PROFIT · USD
+167,912
from 100,000 USD
RETURN
+167.9%
CAGR
+12.4%
8.4 yrs
PROFIT FACTOR
1.28
SHARPE
0.44
MAX DD
-65.3%
equity, relative
RECOVERY
1.56
TRADES
30034
53.9% win

EQUITY · BALANCE (USD)

Crypto_RotationFrontier · BTCUSD H1 · quality 100% real ticks · drag to zoom, double-click to reset

MONTHLY RETURNS

% of balance at month start
YearJanFebMarAprMayJunJulAugSepOctNovDecYear
2018·····0.0%2.5%-14.9%-5.7%-12.0%-9.8%0.5%-34.5%
2019-13.6%-0.8%-9.8%6.8%19.8%10.3%-1.9%-18.4%-8.8%-6.0%-16.3%-2.6%-39.1%
20205.8%13.8%-8.0%2.0%7.9%-7.8%1.1%22.4%0.2%10.9%17.2%5.9%+91.8%
202128.5%27.1%5.3%19.8%-2.1%-0.0%5.3%7.1%-3.9%5.2%-7.0%0.4%+114.4%
2022·-7.5%7.3%-8.0%·-1.7%5.3%1.4%·-0.1%-15.1%-4.8%-22.7%
202313.4%0.5%0.8%3.5%-3.8%-0.8%-0.5%·0.6%2.9%13.3%1.5%+34.4%
2024-7.7%8.8%6.8%3.5%3.7%-1.7%0.1%-14.1%-1.4%3.2%16.6%-4.2%+10.6%
2025-2.4%-5.5%·7.7%6.3%-4.9%22.5%7.0%-1.6%-4.5%·0.3%+23.9%
2026-10.7%·-1.1%6.2%-1.7%·1.0%7.0%16.6%-1.3%··+14.6%

TRADE STATS

Gross profit768,296.35Gross loss-600,383.91
Expected payoff5.59Total deals44721
Long trades30034 (53.9%)Short trades0 (0.0%)
Largest win26,571.71Largest loss-14,605.01
Average win47.44Average loss-43.39
Max consec. wins457Max consec. losses397
Balance DD max62,828.12 (61.1%)Equity DD max107,303.12 (65.3%)
Leverage1:100BrokerWithheld
All report fields (46)
History Quality100% real ticks
Bars70907
Ticks471121195
Symbols2
Total Net Profit167 912.44
Balance Drawdown Absolute60 059.84
Equity Drawdown Absolute60 578.97
Gross Profit768 296.35
Balance Drawdown Maximal62 828.12 (61.14%)
Equity Drawdown Maximal107 303.12 (46.04%)
Gross Loss-600 383.91
Balance Drawdown Relative61.14% (62 828.12)
Equity Drawdown Relative65.31% (74 203.89)
Profit Factor1.28
Expected Payoff5.59
Margin Level12761.29%
Recovery Factor1.56
Sharpe Ratio0.44
Z-Score-151.66 (99.74%)
AHPR1.0000 (0.00%)
LR Correlation0.91
OnTester result267912.4400000004
GHPR1.0000 (0.00%)
LR Standard Error26 490.86
Total Trades30034
Short Trades (won %)0 (0.00%)
Long Trades (won %)30034 (53.93%)
Total Deals44721
Profit Trades (% of total)16196 (53.93%)
Loss Trades (% of total)13838 (46.07%)
Largest profit trade26 571.71
Largest loss trade-14 605.01
Average profit trade47.44
Average loss trade-43.39
Maximum consecutive wins ($)457 (11 856.78)
Maximum consecutive losses ($)397 (-4 082.74)
Maximal consecutive profit (count)38 208.28 (122)
Maximal consecutive loss (count)-24 552.04 (193)
Average consecutive wins17
Average consecutive losses15
Correlation (Profits,MFE)0.66
Correlation (Profits,MAE)0.27
Correlation (MFE,MAE)-0.4134
Minimal position holding time0:00:08
Maximal position holding time890:00:19
Average position holding time202:59:31

NOTES

Buys the stronger of BTC and ETH when its 30-day return is positive, targeting 0.60× account equity. The daily ranking uses completed daily closes. The account targets cash when neither coin qualifies, with position size updated on hourly quotes. These fixed exposure variants were selected retrospectively, and both long tests experienced drawdowns above 50%.

Jun 2018–Oct 2026: +$167,912.44 net, +$1,662.50 per month, 0.981% compounded monthly, 65.31% maximum equity drawdown. Jan 2025–Oct 2026: +$42,603.08 net, +$1,936.50 per month, 1.626% compounded monthly, 21.26% maximum equity drawdown. Each MT5 window starts with USD 100,000. The later windows overlap the long history. The tester booked 0.0014% of closing notional, with swap and spread reflected in the net results.

InputValueOptimise (start / step / stop)Section
TesterOnlytrue
EquityLogId0
Exposure0.6
Crypto_RotationFrontier.mq5277 lines · 10.1 KB · 2026-11-29 ↓ download
View source
#property strict
#property version "1.00"
// Historical research only. Frozen coin-contract sizing, instrument universe and rule.
const ulong LockedMagic=209416941102;
const string LockedAnchor="BTCUSD";
string LegNames[]={"BTCUSD","ETHUSD"};
double LegWeights[]={1.0,1.0};
string MapNames[]={"BTCUSD","ETHUSD"};
string MapSymbols[]={"BTCUSD","ETHUSD"};

// 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 EquityLogId = 0;
input double Exposure = 0.6;
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) && EquityLogId>0)
   {
      const string fn="StrategyResearch\\monthly-"+IntegerToString((long)EquityLogId)+".csv";
      dsMonthlyFile=FileOpen(fn,FILE_WRITE|FILE_CSV|FILE_ANSI|FILE_COMMON,',');
      if(dsMonthlyFile==INVALID_HANDLE) { PrintFormat("Research tester monthly file error %d",GetLastError()); return INIT_FAILED; }
      FileWrite(dsMonthlyFile,"month","first_tick","last_tick","marked_equity","marked_balance","final_tester_equity");
   }
   dsTrade.SetExpertMagicNumber(LockedMagic);
   dsTrade.SetAsyncMode(false);
   return INIT_SUCCEEDED;
}

void OnTick()
{
   const datetime now=TimeCurrent();
   DSObserveMonth(now);
   const datetime hour=(datetime)(((long)now/3600)*3600);
   if(hour!=dsHour)
   {
      dsHour=hour;
      dsWake=0;
      dsFinished=false;
      dsOpeningEquity=AccountInfoDouble(ACCOUNT_EQUITY);
      ArrayInitialize(dsDone,false);
      ArrayInitialize(dsReady,false);
   }
   if(dsFinished || now<dsWake) return;
   bool all=true;
   for(int i=0;i<ArraySize(dsSymbols);i++)
   {
      if(dsDone[i]) continue;
      MqlTick tick;
      const string sym=dsSymbols[i];
      if(!SymbolInfoTick(sym,tick) || tick.time<hour || tick.time>now || tick.bid<=0 ||
         tick.ask<tick.bid || iTime(sym,PERIOD_H1,0)!=hour) { all=false; continue; }
      if(!dsReady[i])
      {
         double weight=0;
         if(!SelectedWeight(i,sym,hour,weight) || !MathIsValidNumber(weight) ||
            MathAbs(weight)>LegWeights[i]+1e-8) { all=false; continue; }
         const int side=weight>0?1:(weight<0?-1:0);
         if(!DSSized(sym,side,tick,MathAbs(weight),dsVolumes[i])) { all=false; continue; }
         dsSides[i]=side;
         dsReady[i]=true;
      }
      dsDone[i]=DSAlign(sym,dsSides[i],dsVolumes[i]);
      if(!dsDone[i]) all=false;
   }
   if(dsMonthlyFile!=INVALID_HANDLE)
   {
      dsLastMarkedEquity=AccountInfoDouble(ACCOUNT_EQUITY);
      dsLastMarkedBalance=AccountInfoDouble(ACCOUNT_BALANCE);
   }
   dsFinished=all;
   dsWake=now+(now-hour<30?1:30);
}

double OnTester()
{
   const double ending=TesterStatistics(STAT_INITIAL_DEPOSIT)+TesterStatistics(STAT_PROFIT);
   DSWriteMonth(true,ending);
   return ending;
}

void OnDeinit(const int reason)
{
   if(dsMonthlyFile!=INVALID_HANDLE) FileClose(dsMonthlyFile);
   PrintFormat("Research execution ended, trade error responses=%u.",dsErrors);
}

FILES

every upload is kept
TypeFileNotesSizeDLSHA-256Uploaded
FILECrypto_RotationFrontier_monthly_equity.csv latestMonth-end marked equity by independent MT5 account. A partial month is identified by its observed broker timestamps.12.9 KB0e55f811459112026-11-29 01:22
BACKTESTCrypto_RotationFrontier_holdfee.html latestMT5 Strategy Tester, USD 100,000 initial capital. 4,954 closed trades. Native net P&L includes −$62.48 commission and −$6,543.73 swap. MT5 history quality: 100% real ticks. Rejected requests: 0.3.5 MB09b2c72bcb07f2026-11-29 01:22
BACKTESTCrypto_RotationFrontier_fullfee.html latestMT5 Strategy Tester, USD 100,000 initial capital. 30,034 closed trades. Native net P&L includes −$319.65 commission and −$103,957.96 swap. MT5 history quality: 100% real ticks. Rejected requests: 0.20.4 MB059a2125dba4c2026-11-29 01:22
PARAMSCrypto_RotationFrontier.set latestStrategy MT5 Strategy Tester preset. Exposure 0.6×.94 B0352c44906b8b2026-11-29 01:22
SOURCECrypto_RotationFrontier.mq5 latestStrategy MQL5 source. Trade rules and sizing are preserved. The optional equity log uses a public identifier.10.1 KB048161b8618912026-11-29 01:22

Other sizes of this rule

The page below uses the same BTC and ETH 30-day rotation rule at a different exposure. This 0.60× page is the main research page. Other published size: 0.497×. Figures scale with the multiplier. They are Strategy Tester simulations, not live results.

MORE CRYPTO STRATEGIES

all Crypto →