Hedge (Multiplicative Weights): Blending a Handful of Simple Trading Rules Online
Introduction
Every trader who's ever coded more than one rule has hit the same wall: the MA cross catches trends, the RSI reversion catches chop, and neither one works when the market decides to switch character halfway through your backtest window. The usual fix is to pick one and live with its blind spots, or to hardcode some kind of regime filter that's really just another rule guessing at the market's mood.
An older idea from online learning handles this more honestly. Instead of picking a winner up front, you let a small set of simple rules vote every bar, track how each one has actually performed across the whole run, and shift trust toward whichever ones have been right most consistently - without ever needing to know in advance which regime you're in. The algorithm is called Hedge, sometimes written as the multiplicative-weights method. It was introduced by Freund and Schapire in the mid-1990s as a way to combine expert predictions with a worst-case performance guarantee, and it later became one of the building blocks behind AdaBoost. The guarantee that matters here: over any sequence of outcomes, Hedge's cumulative loss can't fall too far behind the single best expert in hindsight, no matter how adversarial the sequence looks - you don't need to know which rule will be right ahead of time, only that the algorithm will find out fast enough not to matter much.
That guarantee is a regret bound on directional accuracy, not a profitability guarantee, and the difference matters. Regret measures how much worse the ensemble's bar-by-bar direction calls were than the best single expert's calls over the full horizon. It does not say whether either approach makes money after spread, stops, position sizing, and confidence thresholds. A system can have provably low regret on direction and still lose money, if every expert it blends loses money while calling direction reasonably well.
What Hedge promises is narrower than it sounds: whatever directional edge exists among your five rules - which one calls the next bar's sign most accurately over the full run, not which is most profitable - the ensemble will find and lean into it almost as well as if you'd known in advance which rule to trust for the entire horizon. That comparator is the single best fixed expert over the whole run, not whichever expert is best in the current regime; standard Hedge has no forgetting mechanism, so it carries no formal guarantee of tracking a changing regime, only of eventually catching up to whichever single rule would have been best from the start.
This isn't a full multi-armed-bandit implementation and it isn't a neural net. It's a five-line update rule bolted onto five deliberately dumb trading rules - MA cross, RSI reversion, a Bollinger breakout, a MACD histogram sign, and a Donchian channel breakout - built to show whether adaptive blending earns its keep against the two obvious alternatives: a static equal-weight blend, and trading one of the five rules alone, unblended. All three get tested here, on the same data, with the same risk code underneath them.
I'll walk through the update rule, the code that implements it, and then the part that actually matters: eighteen real Strategy Tester runs across three symbols, two timeframes, and all three blending modes, followed by a full sweep of the one input that theory says should matter most. The results are not a clean "adaptive always wins" story, and I'm reporting them exactly as they came out of the tester.
Contents
- Why blend instead of picking a winner
- The math: multiplicative weights in one paragraph
- Five experts, one vote each
- The ensemble core
- Wiring it into an Expert Advisor
- Risk plumbing worth reading twice
- Watching the weights move
- Testing it honestly: an 18-run matrix
- What actually happened
- Does the textbook learning rate hold up?
- Conclusion
Why blend instead of picking a winner
Say you've got five simple signals and you don't want to spend your life re-optimizing which one to trust this quarter. You could equal-weight them - average their votes and call it a day - which is robust but dumb: it treats a signal that's been dead wrong for three months exactly the same as one that's been dead right. Or you could pick the single best performer over some lookback window and switch to it, which chases whatever just worked and gets whipsawed the moment the regime turns.
Hedge sits between those two. Every expert's absolute weight shrinks when it's wrong and grows when it's right, and the update is multiplicative rather than additive - a run of wrong calls shrinks a weight exponentially, not linearly, so a consistently bad signal gets starved out fast without ever being deleted. That's accumulated accuracy over the entire run, not a recency-weighted score: a correct call from bar 50 contributes exactly as much to the exponent as one from bar 5,000, and nothing gives the last few bars extra pull beyond whatever accuracy they add to the running total. Worth flagging now too: because weights renormalize to sum to 1 after every update, an expert's relative weight can rise on a bar it got wrong, if the other four were more wrong on that same bar - "moves toward accuracy" describes the trend across many bars, not a guarantee on every single one. If the market later proves a demoted signal right again, its weight recovers from wherever it was, no re-initialization required. Nothing here needs to know what "trending" or "ranging" means; it only needs each bar's realized direction.
The exponential part is what separates this from a simple rolling win-rate score. An additive scheme - add a point for a right call, subtract one for a wrong call - treats every mistake the same, regardless of how confident the ensemble currently is in that expert. A multiplicative scheme compounds: an expert already down to a small weight gets punished by a smaller absolute amount for its next mistake (the punishment is a fraction of its current weight, not a fixed increment), while an expert near its starting weight takes a proportionally bigger hit for the same mistake. In practice that means the ensemble demotes a losing rule quickly but doesn't grind an already-marginal rule to zero over one bad patch - there's always a path back if the market turns in its favor again.
The math: multiplicative weights in one paragraph
Each expert i casts a vote v_i(t) ∈ {-1, 0, +1} for bar t. Once the bar closes and the real direction is known, every expert gets scored against what actually happened:
l_i(t) = 0.5 - 0.5 · v_i(t) · sign(t)
That's 0 when the vote was right, 1 when it was flat-out wrong, and 0.5 when the expert abstained or the bar was flat. That 0.5 is a design choice worth naming, not a neutral default: an expert that abstains because it genuinely sees no edge is scored as if it had been half wrong, so a rule that abstains often but is never wrong when it does vote can still lose weight relative to one that always votes and is right only slightly more than half the time. This implementation doesn't distinguish "abstains accurately" from "votes mediocrely." The weight update is then:
w_i(t+1) = w_i(t) · exp(-η · l_i(t)), renormalized so Σw_i = 1
η is the learning rate, and it's the one knob this whole system lives or dies by - too small and the ensemble barely reacts to anything; too large and it overreacts to single-bar noise and effectively becomes a single-expert system that just changes its mind constantly. Online-learning theory gives a regret bound that names a specific value: η = √(8·ln(N)/T), where N is the number of experts and T is the horizon in bars you're planning to run. With 5 experts and a 2000-bar horizon that comes out to roughly 0.080, and that's what the EA computes automatically when InpEta is left at its default of 0. Section 12 is where I actually test whether that theoretical value holds up against real market data, and the answer is more interesting than "yes."
Notice what T actually does in that formula: it isn't the number of bars in your backtest, it's the horizon you tell the formula to plan for, via the InpRegretHorizon input. A larger horizon lowers eta - the bound gets more conservative the longer a stretch of adversarial outcomes it has to survive - while a smaller horizon raises it, letting the ensemble react faster because it's only promising to keep up over a shorter stretch. That's a real design choice hiding inside a single input: telling the formula you're planning for 2,000 bars produces a meaningfully different eta than telling it 20,000 would, on the exact same five experts.
Five experts, one vote each
Every expert is deliberately simple and returns exactly {-1, 0, +1} - no fractional confidence, no extra state. Simplicity here is the point: if the blend does anything useful, it should be visible as weights shifting between plain, well-understood rules, not hidden inside a smarter single model. Each one covers a different, well-worn idea in technical trading, and none of them is meant to be impressive on its own - the MA cross catches sustained directional moves, RSI reversion catches overextension snapping back, the Bollinger and Donchian breakouts both catch a price pushing outside its recent range but measure that range two different ways, and the MACD histogram catches a shift in short-term momentum before price itself has clearly turned. Overlap between them is expected and even useful: it's what gives the ensemble something real to arbitrate between rather than five independent opinions with nothing in common.
HdgVoteMaCross
//+------------------------------------------------------------------+ //| HdgVoteMaCross - trend expert | //+------------------------------------------------------------------+ int HdgVoteMaCross(double fast,double slow) { if(fast>slow) return(1); if(fast<slow) return(-1); return(0); }
HdgVoteRsi
//+------------------------------------------------------------------+ //| HdgVoteRsi - mean-reversion expert | //+------------------------------------------------------------------+ int HdgVoteRsi(double rsi,double lower,double upper) { if(rsi<lower) return(1); if(rsi>upper) return(-1); return(0); }
HdgVoteBollinger
//+------------------------------------------------------------------+ //| HdgVoteBollinger - breakout expert | //+------------------------------------------------------------------+ int HdgVoteBollinger(double price,double upper,double lower) { if(price>upper) return(1); if(price<lower) return(-1); return(0); }
HdgVoteMacdHist
//+------------------------------------------------------------------+ //| HdgVoteMacdHist - momentum expert | //+------------------------------------------------------------------+ int HdgVoteMacdHist(double hist) { if(hist>0.0) return(1); if(hist<0.0) return(-1); return(0); }
HdgVoteDonchian
//+------------------------------------------------------------------+ //| HdgVoteDonchian - channel breakout expert | //+------------------------------------------------------------------+ int HdgVoteDonchian(double price,double upper,double lower) { if(price>=upper) return(1); if(price<=lower) return(-1); return(0); }
MQL5 doesn't ship a Donchian channel indicator, so the fifth expert reads its own high/low window directly rather than reimplementing one as a custom indicator just to feed this EA:
HdgDonchian
//+------------------------------------------------------------------+ //| HdgDonchian - manual channel, no built-in indicator | //+------------------------------------------------------------------+ bool HdgDonchian(string symbol,ENUM_TIMEFRAMES tf,int period,int shift,double &upper,double &lower) { double highs[], lows[]; ArraySetAsSeries(highs,true); ArraySetAsSeries(lows,true); if(CopyHigh(symbol,tf,shift,period,highs)<period) return(false); if(CopyLow(symbol,tf,shift,period,lows)<period) return(false); upper = highs[ArrayMaximum(highs)]; lower = lows[ArrayMinimum(lows)]; return(true); }
One limitation worth stating plainly rather than letting the name imply more than the code does: HdgDonchian is called with shift=1, and HdgVoteDonchian then tests that same shift-1 close against the channel it just built - so the channel window includes the very bar the vote is cast on. That's closer to "did this bar close at the extreme of its own window" than a textbook breakout, which would test the close against a channel built strictly from the bars before it. It's still look-ahead-free - nothing here peeks forward - but it's not quite the classic definition the name suggests. I'm documenting that here rather than quietly changing the shift, because doing so would alter this expert's vote on every bar of every backtest in Section 10, and the published numbers would no longer describe the code shipped here. Decide on purpose which definition you want before trusting the label.
The ensemble core
Everything the article's actually about lives in one small class. The mode enum decides how the five votes get combined, independent of how the weights themselves evolve:
ENUM_ENSEMBLE_MODE and CHedgeEnsemble
enum ENUM_ENSEMBLE_MODE { MODE_HEDGE, // adaptive multiplicative-weights blend MODE_EQUAL_WEIGHT, // fixed 1/N blend, no learning MODE_SINGLE_EXPERT // trades one expert only, for comparison }; //+------------------------------------------------------------------+ //| CHedgeEnsemble - multiplicative-weights blender | //+------------------------------------------------------------------+ class CHedgeEnsemble { private: double m_w[HDG_EXPERTS]; // current weights, sum to 1 double m_prev_votes[HDG_EXPERTS]; // votes still awaiting a verdict double m_eta; // learning rate bool m_have_prev; // false until the first bar is scored public: void Init(double eta); bool HasPrevVotes(void) const { return(m_have_prev); } void RememberVotes(const double &votes[]); void ScoreAndUpdate(double realized_sign); double EnsembleSignal(const double &votes[],ENUM_ENSEMBLE_MODE mode,int single_idx) const; double Weight(int idx) const { return((idx>=0 && idx<HDG_EXPERTS) ? m_w[idx] : 0.0); } void Weights(double &out[]) const; };
Weights start uniform - nobody's trusted more than anyone else on bar one - and every method after Init exists to answer one of three questions: what did we just learn, what do we do next bar, and what does the outside world get to see.
Init and RememberVotes
//+------------------------------------------------------------------+ //| CHedgeEnsemble::Init | //+------------------------------------------------------------------+ void CHedgeEnsemble::Init(double eta) { m_eta = eta; m_have_prev = false; for(int i=0; i<HDG_EXPERTS; i++) { m_w[i] = 1.0/HDG_EXPERTS; //--- uniform start, nobody trusted yet m_prev_votes[i] = 0.0; } } //+------------------------------------------------------------------+ //| CHedgeEnsemble::RememberVotes | //+------------------------------------------------------------------+ void CHedgeEnsemble::RememberVotes(const double &votes[]) { for(int i=0; i<HDG_EXPERTS; i++) m_prev_votes[i] = votes[i]; m_have_prev = true; }The votes an expert casts this bar can't be scored until next bar's close reveals whether they were right, so they get parked in m_prev_votes and scored one tick later - this is what keeps the whole system look-ahead-free.
ScoreAndUpdate
//+------------------------------------------------------------------+ //| CHedgeEnsemble::ScoreAndUpdate | //+------------------------------------------------------------------+ void CHedgeEnsemble::ScoreAndUpdate(double realized_sign) { if(!m_have_prev) return; double loss[HDG_EXPERTS]; double sum_w = 0.0; //--- level 1: score yesterday's votes, reweight, renormalize for(int i=0; i<HDG_EXPERTS; i++) { loss[i] = 0.5 - 0.5*m_prev_votes[i]*realized_sign; // 0 right, 1 wrong, 0.5 flat m_w[i] = m_w[i]*MathExp(-m_eta*loss[i]); sum_w += m_w[i]; } if(sum_w<=0.0) sum_w = 1.0; for(int i=0; i<HDG_EXPERTS; i++) m_w[i] /= sum_w; }
That's the entire algorithm in eleven lines: score, exponentiate, renormalize. Everything else in this article is plumbing around this one function.
EnsembleSignal and Weights
//+------------------------------------------------------------------+ //| CHedgeEnsemble::EnsembleSignal | //+------------------------------------------------------------------+ double CHedgeEnsemble::EnsembleSignal(const double &votes[],ENUM_ENSEMBLE_MODE mode,int single_idx) const { if(mode==MODE_SINGLE_EXPERT) return((single_idx>=0 && single_idx<HDG_EXPERTS) ? votes[single_idx] : 0.0); double signal = 0.0; for(int i=0; i<HDG_EXPERTS; i++) { double w = (mode==MODE_EQUAL_WEIGHT) ? (1.0/HDG_EXPERTS) : m_w[i]; signal += w*votes[i]; } return(signal); } //+------------------------------------------------------------------+ //| CHedgeEnsemble::Weights | //+------------------------------------------------------------------+ void CHedgeEnsemble::Weights(double &out[]) const { ArrayResize(out,HDG_EXPERTS); for(int i=0; i<HDG_EXPERTS; i++) out[i] = m_w[i]; }
EnsembleSignal is where the three test modes actually diverge - MODE_HEDGE uses the learned m_w weights, MODE_EQUAL_WEIGHT overrides every weight to a flat 1/N on the spot without touching m_w itself, and MODE_SINGLE_EXPERT ignores the ensemble entirely and just returns one expert's raw vote. Using the same EA in all three modes on identical data is what makes an apples-to-apples comparison possible later. The indicator handles, risk code, and order-sending path are identical; only the blend-mode dropdown in the Inputs tab changes between one Strategy Tester pass and the next. That's deliberate: any difference in the results has to come from how the votes get combined, not from three different pieces of code doing three different things underneath.
Wiring it into an Expert Advisor
The EA's job is mostly bookkeeping: collect five votes, score last bar's votes before trusting new ones, publish the resulting weights, and trade only when the blended signal clears a confidence threshold.
Ensemble inputs
input group "Ensemble" input ENUM_ENSEMBLE_MODE InpMode = MODE_HEDGE; // Blend mode input double InpEta = 0.0; // Learning rate, 0 = auto from horizon input int InpRegretHorizon = 2000; // Bars used to size auto learning rate input double InpConfidence = 0.20; // Weighted signal needed to trade input int InpSingleIdx = 0; // Expert index, Single-expert mode only
That's the Ensemble group - the rest are the five experts' own periods plus risk/execution plumbing, every one at its shipped default for all eighteen runs below:
| Group | Input | Default | What it controls |
|---|---|---|---|
| Expert 1: MA Cross | InpMaFast | 10 | Fast MA period |
| Expert 1: MA Cross | InpMaSlow | 50 | Slow MA period |
| Expert 2: RSI Reversion | InpRsiPeriod | 14 | RSI period |
| Expert 2: RSI Reversion | InpRsiLower | 30.0 | Oversold trigger |
| Expert 2: RSI Reversion | InpRsiUpper | 70.0 | Overbought trigger |
| Expert 3: Bollinger Breakout | InpBbPeriod | 20 | BB period |
| Expert 3: Bollinger Breakout | InpBbDeviation | 2.0 | BB deviation |
| Expert 4: MACD Histogram | InpMacdFast | 12 | Fast EMA |
| Expert 4: MACD Histogram | InpMacdSlow | 26 | Slow EMA |
| Expert 4: MACD Histogram | InpMacdSignal | 9 | Signal SMA |
| Expert 5: Donchian Breakout | InpDonchianPeriod | 20 | Channel lookback |
| Risk Management | InpRiskPercent | 1.0 | Risk per trade, % of equity |
| Risk Management | InpAtrMultSl | 2.0 | Stop-loss, ATR multiples |
| Risk Management | InpAtrMultTp | 3.0 | Take-profit, ATR multiples |
| Risk Management | InpAtrPeriod | 14 | ATR period |
| Risk Management | InpStopPadPoints | 10.0 | Extra pad beyond broker minimum |
| Execution | InpMagic | 20260927 | Magic number |
| Execution | InpSlippage | 5 | Max slippage, points |
None of those risk/execution numbers were tuned against this data - they're reasonable round-number defaults (1% risk, a 2x/3x ATR stop/take pair, a 0.20 confidence floor), not swept for a best fit. A sensitivity check on InpConfidence or the ATR multiples could move every number in Section 10 up or down, and no such sweep has been run - the same open gap as the eta sweep in Section 12, just on different inputs. Treat them as worth testing on your own instrument, not as settings this article already validated.
OnInit
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- level 1: indicator handles g_h_ma_fast = iMA(_Symbol,_Period,InpMaFast,0,MODE_EMA,PRICE_CLOSE); g_h_ma_slow = iMA(_Symbol,_Period,InpMaSlow,0,MODE_EMA,PRICE_CLOSE); g_h_rsi = iRSI(_Symbol,_Period,InpRsiPeriod,PRICE_CLOSE); g_h_bb = iBands(_Symbol,_Period,InpBbPeriod,0,InpBbDeviation,PRICE_CLOSE); g_h_macd = iMACD(_Symbol,_Period,InpMacdFast,InpMacdSlow,InpMacdSignal,PRICE_CLOSE); g_h_atr = iATR(_Symbol,_Period,InpAtrPeriod); if(g_h_ma_fast==INVALID_HANDLE || g_h_ma_slow==INVALID_HANDLE || g_h_rsi==INVALID_HANDLE || g_h_bb==INVALID_HANDLE || g_h_macd==INVALID_HANDLE || g_h_atr==INVALID_HANDLE) { Print("HedgeEnsemble: indicator handle creation failed"); return(INIT_FAILED); } //--- level 1: multiplicative-weights core double eta = InpEta; if(eta<=0.0) eta = MathSqrt(8.0*MathLog(HDG_EXPERTS)/MathMax(InpRegretHorizon,10)); g_hedge.Init(eta); //--- level 1: audit log, folder first or FileOpen fails silently g_files_sub = "HedgeEnsemble"; HdgEnsureFilesFolder(g_files_sub); g_log_name = g_files_sub+"\\weights_"+IntegerToString((int)InpMagic)+".csv"; g_log_handle = FileOpen(g_log_name,FILE_WRITE|FILE_CSV|FILE_ANSI,','); if(g_log_handle==INVALID_HANDLE) Print("HedgeEnsemble: FileOpen(",g_log_name,") failed, err=",GetLastError()); else FileWrite(g_log_handle,"time","w_ma","w_rsi","w_bb","w_macd","w_donchian","signal"); g_last_bar_time = 0; return(INIT_SUCCEEDED); }
The auto-eta line is the regret bound from Section 4, computed from the expert count and horizon rather than left as a magic number - leaving InpEta at 0 is what makes every run in the matrix use the theoretical value by default. One detail the formula in Section 4 doesn't show: MathMax(InpRegretHorizon,10) floors the horizon at 10 bars, so an unreasonably small InpRegretHorizon can't blow up eta into something absurd. At the 2000-bar default used throughout this article, that floor never engages - it only matters if you set InpRegretHorizon below 10 yourself.
CollectVotes
//+------------------------------------------------------------------+ //| CollectVotes - one vote per expert, shift-1 data only | //+------------------------------------------------------------------+ void CollectVotes(double &votes[]) { ArrayResize(votes,HDG_EXPERTS); double ma_fast[1], ma_slow[1], rsi[1], bb_up[1], bb_dn[1]; double macd_main[1], macd_signal[1], close1[1]; //--- level 1: validate every data read before trusting it for a vote bool ok = true; ok = ok && CopyBuffer(g_h_ma_fast,0,1,1,ma_fast)==1; ok = ok && CopyBuffer(g_h_ma_slow,0,1,1,ma_slow)==1; ok = ok && CopyBuffer(g_h_rsi,0,1,1,rsi)==1; ok = ok && CopyBuffer(g_h_bb,1,1,1,bb_up)==1; ok = ok && CopyBuffer(g_h_bb,2,1,1,bb_dn)==1; ok = ok && CopyBuffer(g_h_macd,0,1,1,macd_main)==1; ok = ok && CopyBuffer(g_h_macd,1,1,1,macd_signal)==1; ok = ok && CopyClose(_Symbol,_Period,1,1,close1)==1; double don_up=0.0, don_dn=0.0; ok = ok && HdgDonchian(_Symbol,_Period,InpDonchianPeriod,1,don_up,don_dn); if(!ok) { //--- a read failed this bar - cast flat votes rather than act on a //--- stale or zeroed buffer; this is a defensive fallback that almost //--- never triggers against a complete, already-downloaded history Print("HedgeEnsemble: CollectVotes data read failed, casting flat votes this bar"); ArrayInitialize(votes,0.0); return; } votes[0] = HdgVoteMaCross(ma_fast[0],ma_slow[0]); votes[1] = HdgVoteRsi(rsi[0],InpRsiLower,InpRsiUpper); votes[2] = HdgVoteBollinger(close1[0],bb_up[0],bb_dn[0]); votes[3] = HdgVoteMacdHist(macd_main[0]-macd_signal[0]); votes[4] = HdgVoteDonchian(close1[0],don_up,don_dn); }
Every buffer read here uses shift 1, the last fully closed bar, never shift 0 - that's what keeps the ensemble free of look-ahead bias. The validation above is purely defensive: against a complete history in the Strategy Tester a read essentially never fails, so it changes none of the eighteen runs below - it only protects a live chart from trading on a zeroed buffer.
OnTick
//+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { if(!HdgIsNewBar(_Symbol,_Period,g_last_bar_time)) return; double votes[]; CollectVotes(votes); //--- level 1: score the previous bar's votes before trusting new ones if(g_hedge.HasPrevVotes()) { double close1[1], close2[1]; bool got_closes = CopyClose(_Symbol,_Period,1,1,close1)==1 && CopyClose(_Symbol,_Period,2,1,close2)==1; if(got_closes) { double realized_sign = (close1[0]>close2[0]) ? 1.0 : (close1[0]<close2[0] ? -1.0 : 0.0); g_hedge.ScoreAndUpdate(realized_sign); } else Print("HedgeEnsemble: realized-sign CopyClose failed, skipping this bar's weight update"); } double signal = g_hedge.EnsembleSignal(votes,InpMode,InpSingleIdx); g_hedge.RememberVotes(votes); //--- these become tomorrow's prev_votes //--- level 1: publish weights for the sub-window indicator and the audit log double w[]; g_hedge.Weights(w); GlobalVariableSet("HDG_"+IntegerToString((int)InpMagic)+"_W0",w[0]); GlobalVariableSet("HDG_"+IntegerToString((int)InpMagic)+"_W1",w[1]); GlobalVariableSet("HDG_"+IntegerToString((int)InpMagic)+"_W2",w[2]); GlobalVariableSet("HDG_"+IntegerToString((int)InpMagic)+"_W3",w[3]); GlobalVariableSet("HDG_"+IntegerToString((int)InpMagic)+"_W4",w[4]); if(g_log_handle!=INVALID_HANDLE) FileWrite(g_log_handle,TimeToString(iTime(_Symbol,_Period,1)), w[0],w[1],w[2],w[3],w[4],signal); //--- level 1: act only when flat - on a netting account a symbol carries //--- exactly one net position regardless of which magic opened it, so any //--- open position on this symbol blocks a new entry, not just this EA's own if(PositionSelect(_Symbol)) return; if(signal>=InpConfidence) ExecuteTrade(1); else if(signal<=-InpConfidence) ExecuteTrade(-1); }
Note that ScoreAndUpdate runs before EnsembleSignal - last bar's outcome updates the weights first, then the updated ensemble votes on the new bar. Also worth flagging: ScoreAndUpdate and Weights() run unconditionally regardless of InpMode, which is why the audit CSV shows real learned weights even during an equal-weight or single-expert run - the learning never actually stops, it's only EnsembleSignal that chooses whether to act on it. The realized-sign read is now guarded like the vote reads already were: a short CopyClose skips that bar's weight update instead of scoring off a zeroed array - essentially never fires against the Tester's complete history, same as the CollectVotes guard above.
Worth flagging too: the flat check now looks at whether any position is open on this symbol at all, not whether this EA's own magic opened it - on a netting account there's only one net position per symbol regardless of which magic placed it last, so checking the magic added a gap rather than protection. No other magic ran alongside this EA in the eighteen runs below, so the fix changes nothing published. It's still netting-only: a hedging-account build would need to loop PositionsTotal() and match symbol/magic explicitly.
ExecuteTrade
//+------------------------------------------------------------------+ //| ExecuteTrade - sizes and sends one market order | //+------------------------------------------------------------------+ void ExecuteTrade(int direction) { if(direction==0) return; double atr[1]; if(CopyBuffer(g_h_atr,0,1,1,atr)!=1) { Print("HedgeEnsemble: ATR read failed, skipping this trade"); return; } double min_dist = HdgMinStopDistance(_Symbol,InpStopPadPoints); double sl_dist = MathMax(atr[0]*InpAtrMultSl,min_dist); double tp_dist = MathMax(atr[0]*InpAtrMultTp,min_dist); ENUM_ORDER_TYPE type = (direction>0) ? ORDER_TYPE_BUY : ORDER_TYPE_SELL; double price = SymbolInfoDouble(_Symbol,(direction>0) ? SYMBOL_ASK : SYMBOL_BID); double sl = (direction>0) ? price-sl_dist : price+sl_dist; double tp = (direction>0) ? price+tp_dist : price-tp_dist; double risk_money = AccountInfoDouble(ACCOUNT_EQUITY)*InpRiskPercent/100.0; double lot = HdgCalcSafeLot(_Symbol,risk_money,sl_dist,type); if(lot<=0.0) { Print("HedgeEnsemble: lot sizing skipped the trade, margin or min-lot floor"); return; } MqlTradeRequest request; MqlTradeResult result; ZeroMemory(request); ZeroMemory(result); request.action = TRADE_ACTION_DEAL; request.symbol = _Symbol; request.volume = lot; request.type = type; request.price = price; request.sl = NormalizeDouble(sl,_Digits); request.tp = NormalizeDouble(tp,_Digits); request.deviation = InpSlippage; request.magic = InpMagic; request.comment = "HedgeEnsemble"; //--- level 1: a true return only means the request was accepted for //--- processing - the retcode is what actually says whether it filled if(!OrderSend(request,result) || result.retcode!=TRADE_RETCODE_DONE) PrintFormat("HedgeEnsemble: OrderSend not fully executed, err=%d retcode=%d", GetLastError(),result.retcode); }
This checks result.retcode too, since a true return from OrderSend only means the server accepted the request - not that it filled. Without that check, a rejected order would log nothing and look identical, in the Journal, to a clean fill. The ATR read above it is guarded the same way - a failed CopyBuffer skips the trade rather than sizing stops off a zeroed buffer.
OnDeinit and OnTester
//+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { IndicatorRelease(g_h_ma_fast); IndicatorRelease(g_h_ma_slow); IndicatorRelease(g_h_rsi); IndicatorRelease(g_h_bb); IndicatorRelease(g_h_macd); IndicatorRelease(g_h_atr); if(g_log_handle!=INVALID_HANDLE) FileClose(g_log_handle); } //+------------------------------------------------------------------+ //| Tester event handler - optimization criterion | //+------------------------------------------------------------------+ double OnTester() { double w[]; g_hedge.Weights(w); PrintFormat("HedgeEnsemble final weights: ma=%.4f rsi=%.4f bb=%.4f macd=%.4f donchian=%.4f", w[0],w[1],w[2],w[3],w[4]); return(TesterStatistics(STAT_PROFIT_FACTOR)); }
OnTester is what makes the optimization sweep in Section 12 possible in the first place - returning the real profit factor here means the Strategy Tester's optimizer can actually rank every InpEta pass by a trading metric instead of by raw account balance.
Risk plumbing worth reading twice
None of this is specific to Hedge, but skipping it is how a good idea turns into a blown demo account - three helpers any order-sending EA should carry by default.
HdgMinStopDistance
//+------------------------------------------------------------------+ //| HdgMinStopDistance - broker floor, never trust one field alone | //+------------------------------------------------------------------+ double HdgMinStopDistance(string symbol,double pad_points) { long stops_level = SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL); long freeze_level = SymbolInfoInteger(symbol,SYMBOL_TRADE_FREEZE_LEVEL); long spread = SymbolInfoInteger(symbol,SYMBOL_SPREAD); double point = SymbolInfoDouble(symbol,SYMBOL_POINT); long base_points = MathMax(stops_level,freeze_level); return((base_points+spread+pad_points)*point); }
Some brokers set SYMBOL_TRADE_STOPS_LEVEL to zero and enforce the real floor through SYMBOL_TRADE_FREEZE_LEVEL instead, or vice versa - taking the max of both, then padding for spread and a manual buffer, is cheap insurance against an "invalid stops" rejection on the one broker that does it differently.
HdgCalcSafeLot
//+------------------------------------------------------------------+ //| HdgCalcSafeLot - risk sizing clamped by real margin | //+------------------------------------------------------------------+ double HdgCalcSafeLot(string symbol,double risk_money,double sl_distance,ENUM_ORDER_TYPE type) { double tick_value = SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE); double tick_size = SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_SIZE); if(tick_size<=0.0 || sl_distance<=0.0) return(0.0); double loss_per_lot = (sl_distance/tick_size)*tick_value; if(loss_per_lot<=0.0) return(0.0); double vol_min = SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN); double vol_max = SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX); double vol_limit = SymbolInfoDouble(symbol,SYMBOL_VOLUME_LIMIT); double vol_step = SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP); double cap = (vol_limit>0.0) ? MathMin(vol_max,vol_limit) : vol_max; double lot = MathFloor((risk_money/loss_per_lot)/vol_step)*vol_step; lot = MathMin(lot,cap); if(lot<vol_min) return(0.0); //--- rounds below broker minimum, skip rather than round up double price = SymbolInfoDouble(symbol,(type==ORDER_TYPE_BUY) ? SYMBOL_ASK : SYMBOL_BID); double margin_required = 0.0; if(!OrderCalcMargin(type,symbol,lot,price,margin_required)) return(0.0); double free_margin = AccountInfoDouble(ACCOUNT_MARGIN_FREE); while(margin_required>free_margin && lot>vol_min) { lot -= vol_step; lot = NormalizeDouble(lot,8); if(!OrderCalcMargin(type,symbol,lot,price,margin_required)) return(0.0); } if(lot<vol_min || margin_required>free_margin) return(0.0); return(lot); }
The rounding direction matters more than it looks: rounding a lot size up to the broker minimum silently takes on more risk than the input asked for. This rounds down and skips the trade outright when the risk-implied size can't clear the minimum lot - a missed trade, never an oversized one. The margin-clamping loop that follows does the same kind of thing at the account level: it checks the real margin requirement OrderCalcMargin returns against actual free margin, and steps the lot size down one volume step at a time until the trade fits or the size drops below the broker's minimum, at which point it gives up rather than sending an order the account can't support. None of this is specific to Hedge - any order-sending EA needs the same real-margin check, since a working ensembling idea is still worthless if the account gets margin-called first.
HdgEnsureFilesFolder and HdgIsNewBar
//+------------------------------------------------------------------+ //| HdgEnsureFilesFolder - FileOpen needs the folder first | //+------------------------------------------------------------------+ bool HdgEnsureFilesFolder(string sub_folder) { ResetLastError(); bool ok = FolderCreate(sub_folder); int err = GetLastError(); //--- FolderCreate can return false purely because the folder is already //--- there from a previous run; that isn't a real failure, so only a //--- genuine, nonzero error gets logged as one - and the return value //--- now reflects it instead of always claiming success if(!ok && err!=0) { Print("HedgeEnsemble: FolderCreate(",sub_folder,") failed, err=",err); return(false); } return(true); } //+------------------------------------------------------------------+ //| HdgIsNewBar - fires once per closed bar | //+------------------------------------------------------------------+ bool HdgIsNewBar(string symbol,ENUM_TIMEFRAMES tf,datetime &last_time) { datetime t = iTime(symbol,tf,0); if(t==last_time) return(false); last_time = t; return(true); }
FileOpen doesn't create a missing subfolder on its own - it fails silently and returns INVALID_HANDLE with no Journal message unless the caller checks and prints GetLastError() itself. Calling FolderCreate once before the first FileOpen is what keeps the weight-audit CSV from quietly never existing. FolderCreate can also return false simply because the folder already exists from an earlier run - the version above only logs when GetLastError() reports a genuine nonzero code, so a re-run doesn't spam the Journal with a false "failed" message. One more fix worth naming: this function used to return true unconditionally, even on a genuine error - it now returns false in that one case. OnInit doesn't check the return value today, so this changes nothing in the eighteen runs below; it only stops the function from lying to a future caller that does.
Watching the weights move
A sub-window indicator reads the five GlobalVariables the EA publishes every bar and plots them as five lines, purely for a live, visual sanity check while the EA runs - it isn't what produced Figure 1, which was rebuilt from the audit CSV for higher fidelity, but it's what you'd actually watch on a live chart.
ReadWeight and OnCalculate
//+------------------------------------------------------------------+ //| ReadWeight - falls back to an even split if the EA is silent | //+------------------------------------------------------------------+ double ReadWeight(int idx) { string name = g_prefix+IntegerToString(idx); if(GlobalVariableCheck(name)) return(GlobalVariableGet(name)); return(0.2); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int start = (prev_calculated==0) ? 0 : prev_calculated-1; //--- level 1: only the newest bars move, older ones keep what was live then for(int i=start; i<rates_total; i++) { BufMa[i] = ReadWeight(0); BufRsi[i] = ReadWeight(1); BufBb[i] = ReadWeight(2); BufMacd[i] = ReadWeight(3); BufDonchian[i] = ReadWeight(4); } return(rates_total); }
The 0.2 fallback matters for one case: an indicator attached before the EA's first bar shows an honest "nobody's trusted yet" flat line instead of a misleading zero.
Testing it honestly: an 18-run matrix
One comparator distinction worth nailing down first: Section 4's regret bound is against the single best expert in hindsight, but MODE_SINGLE_EXPERT below runs only the MA-cross expert (InpSingleIdx at its default of 0) - a fixed, naive baseline, not the actual best of the five after the fact. So read "beats the single-expert baseline" below as "beats trading MA-cross alone."
An adaptive-blending claim is exactly the kind of edge claim that falls apart on a single symbol and timeframe, so this got tested across all three blend modes ( MODE_HEDGE, MODE_EQUAL_WEIGHT, MODE_SINGLE_EXPERT - the last with the MA-cross expert as the naive baseline) on three symbols (EURUSD, GBPUSD, XAUUSD) and two timeframes (H1, M15) - eighteen single-pass Strategy Tester runs total, every one at the EA's shipped default inputs, over the identical 2026.01.01-2026.09.01 window, every-tick modeling against real ticks, a $10,000 deposit at 1:100 leverage. Nothing here is optimized to look good; the eighteen numbers are what the tester actually returned.
Reproducing those numbers needs the full testing environment spelled out, not just the inputs - here it is, without naming the broker:
| Setting | Value |
|---|---|
| Server | MetaQuotes-Demo, Build 6231 - the platform's own public demo server |
| Deposit/leverage | $10,000/1:100 |
| Tick generation | Every tick, History Quality 100% real ticks in every one of the eighteen reports |
| Spread | Real, variable - taken from the historical tick data itself; no fixed custom spread was configured |
| Commission/swap | $0.00 on every recorded deal in all eighteen runs - checked directly against each run's own Deals table, not assumed |
| Order filling policy | Unset in ExecuteTrade's MqlTradeRequest, so it falls back to the symbol's own broker-default filling mode |
EURUSD and GBPUSD check whether a pattern is a genuine property of the approach or just one pair's quirk - though they aren't statistically independent, both USD pairs that tend to move together, so a pattern on both is one pattern seen twice, not two confirmations. XAUUSD adds a different price scale and volatility profile, which mattered more than blend mode once the results came in. H1 and M15 share the identical InpRegretHorizon of 2000 bars, and the calendar coverage matters: FX/CFD trades roughly 24 hours a day, five days a week, about 120 H1 bars and 480 M15 bars per week.
That puts 2000 H1 bars at under four months, 2000 M15 bars at just over four weeks - roughly four times more calendar time on H1 than M15, the mismatch Section 12 investigates. Summed across all eighteen runs, the matrix produced 8,599 total trades, past the few-hundred-trade floor worth seeing before any backtest is worth reading - but those trades are pooled across three symbols, two timeframes and three modes, so the total doesn't establish reliability for any single comparison; each cell still stands on its own, smaller count.
What actually happened

Fig. 1. Profit factor by blend mode across all eighteen runs of the testing matrix.
| Symbol / TF | Hedge (PF/net) | Equal weight (PF/net) | Single expert (PF/net) | Ranking (by net loss) |
|---|---|---|---|---|
| EURUSD H1 | 0.91/-1,097.92 | 0.98/-317.81 | 0.87/-1,952.73 | Equal > Hedge > Single |
| EURUSD M15 | 0.97/-1,446.09 | 0.92/-3,948.28 | 0.84/-6,204.43 | Hedge > Equal > Single |
| GBPUSD H1 | 0.69/-3,163.57 | 0.89/-1,583.43 | 0.86/-1,818.58 | Equal > Single > Hedge |
| GBPUSD M15 | 0.95/-1,741.85 | 0.84/-6,016.55 | 0.92/-3,708.64 | Hedge > Single > Equal |
| XAUUSD H1 | 0.91/-8,671.55 | 0.91/-9,006.83 | 0.90/-8,513.10 | Single > Hedge > Equal |
| XAUUSD M15 | 0.99/-9,731.41 | 0.95/-9,931.11 | 0.99/-9,894.04 | Hedge > Single > Equal |
None of the six combinations produced a net profit for any of the three modes - this isn't a system to trade as shipped, and I'm not going to pretend otherwise. The more useful question was never "does Hedge make money," it was "does adapting the blend beat the two obvious static alternatives," and the honest answer is: sometimes, in a pattern worth taking seriously rather than dismissing as noise - with a caveat attached that I'd rather state than skip.
On both FX pairs, the result flips cleanly by timeframe: Hedge loses to equal-weight on H1 (EURUSD and GBPUSD both), but beats it clearly on M15 (same two pairs, same direction, same margin) - one pattern seen twice on correlated pairs, worth taking seriously, not an independently replicated result. The likely reason is that the H1 and M15 auto-eta are both computed from the same 2000-bar regret horizon, which (Section 10) covers roughly four times more calendar time on H1 than on M15 - so the same theoretical rate ends up better matched to how fast the M15 regime actually shifts, a theory Section 12's sweep goes on to test directly. A genuinely independent check - an uncorrelated pair, or enough symbols for a real significance test - is the obvious next step before leaning on this harder than "repeated twice on related pairs" supports.
The single-expert baseline isn't a strawman that reliably loses either - it beat Hedge outright on GBPUSD H1, and on XAUUSD H1 it posted the lowest net loss and drawdown of the three despite the lowest profit factor. That split is a reminder that profit factor and net loss don't always rank the same system the same way - the ranking column above sorts by net loss, the number with direct dollar impact, and XAUUSD H1 is exactly the row where that disagrees with a profit-factor-only ranking. Ensembling isn't a free upgrade over a single decent rule; it has to earn its complexity on the data in front of it, and here it didn't always.
The clearest signal in the whole matrix sits in the learned weights themselves rather than the trade outcomes. Figure 2 shows the full run of weight evolution for EURUSD M15 - RSI reversion climbs from its uniform 0.20 starting point to over 0.98 by August, and it does the same thing (0.735-0.987 by the end) on every one of the four FX runs, regardless of pair or timeframe. Whatever regime this nine-month window actually was, RSI mean-reversion was consistently the least-wrong of the five experts, and the ensemble found that on its own with no hint beyond bar-by-bar accuracy.

Fig. 2. Learned expert weights over the full test window, EURUSD M15, Hedge mode.
Gold breaks that pattern entirely. On XAUUSD H1 the top expert by final weight is MA cross (0.46), with the other four spread far more evenly than on any FX run - the opposite of what every FX pair rewarded. Drawdown there ran 94.03% (single expert) to 97.57% (equal weight) to 95.06% (Hedge), all three effectively wiping the demo account with barely a point separating them. XAUUSD M15 was worse: 99.84-99.90% max drawdown across all three modes, and equal-weight posted a Sharpe of -3.02, the worst risk-adjusted number in the eighteen runs. Blend mode barely mattered on gold - Hedge, equal-weight and single-expert all failed in roughly the same way, which at least rules out the ensembling logic as the cause.
Sizing is one plausible contributor worth naming honestly: the ATR multiple and stop padding were never tuned for gold, even though HdgCalcSafeLot already converts risk into lots via the symbol's own tick value and size. I can't say sizing alone explains a near-total drawdown - it's equally consistent with trade frequency, the fixed ATR multiples, XAUUSD's tick-value spec, weaker signal quality, or a bad window for this instrument. The narrower claim the data supports: blend mode wasn't the deciding factor on XAUUSD. This instrument needs a dedicated review before running the EA on gold again.
Does the textbook learning rate hold up?
Section 4 named a specific value for η from the regret-bound formula - roughly 0.080 for 5 experts over a 2000-bar horizon, and that's exactly what every Hedge-mode run above used, since InpEta was left at its default of 0. Theory guarantees that this value bounds Hedge's worst-case regret against the best expert in hindsight; it says nothing about whether it's the value that performs best on one specific real market window. So I ran a full Strategy Tester optimization on EURUSD M15 - the combination where Hedge showed its clearest real edge above - sweeping InpEta alone from 0.005 to 0.200 in steps of 0.005, forty passes, Complete algorithm, everything else held at its shipped default.

Fig. 3. Profit factor across the full InpEta sweep, EURUSD M15, forty real Strategy Tester passes.
One thing to be upfront about before reading anything into that curve: this sweep ran and was interpreted entirely in-sample, on the exact EURUSD M15 combination already used to show Hedge's clearest edge in Section 11. A clean single-peaked hump on data already looked at is good evidence that eta does something real to the ensemble's behavior rather than getting drowned out by randomness; it isn't yet evidence that eta = 0.040-0.050 is right anywhere else. The theoretical default of 0.080 lands at profit factor 0.97, a net loss of -1,446.09 - the same number reported for EURUSD M15 above, since that run used the auto-computed value.
No split-sample or walk-forward check has been run on this sweep. Eta = 0.040-0.050 is what performed best inside this one in-sample demonstration, on the window already used to pick the combination - not a value validated on data the sweep never saw, and not a tuned setting to carry into live use. The procedural takeaway here (sweep eta per instrument and timeframe before trusting a default) rests on firmer ground than the specific 0.040-0.050 number does.
The sweep's peak sits at eta = 0.040 to 0.050, profit factor 0.99 across all three passes there, net loss as low as -355.32 at the single highest pass - a reduction of roughly 4.1x versus the theoretical default's -1,446.09 (not "almost three times," worth being exact since the real ratio is bigger). That's a demonstration of how sensitive this one in-sample run is to eta, not a confirmed preferred value: performance falls away in both directions from the peak, and the two extremes tested, eta = 0.005 and 0.200, both landed at profit factor 0.93-0.94, the lowest in the whole sweep.
The honest reading isn't "the formula is wrong" - the regret bound is a worst-case guarantee across every adversarial sequence of outcomes, and real market data isn't adversarial in that sense. It's closer to this: the theoretical rate is tuned for the worst case Hedge could ever face, more reactive than this particular nine months of EURUSD M15 called for. A slower rate let the ensemble track the slower-moving RSI-dominance regime from Figure 2 instead of getting knocked around by every noisy losing bar - a real finding from this sweep, and a useful one: don't assume the textbook learning rate fits your instrument without running this kind of sweep yourself first.
Forty passes on one symbol and one timeframe show the shape of the eta/performance relationship on that specific combination, not that eta=0.045 is a universal constant to hardcode everywhere. Given how differently XAUUSD behaved in Section 11, the more defensible conclusion is procedural rather than numerical: treat InpEta as a parameter worth sweeping per instrument and timeframe, the same way you'd already treat an indicator period, rather than trusting the auto-formula or a single borrowed value everywhere. The sweep here demonstrates that procedure; it doesn't replace running it on your own, and closing it for real still means the split-sample or walk-forward check flagged above.
Conclusion
Hedge did what it's supposed to do mechanically - it tracked which of five simple rules was actually working and shifted trust toward it continuously, with no manual regime-switching logic anywhere in the code. Whether that mechanical correctness translates into a better trading system turned out to depend heavily on the timeframe and the instrument, not on the algorithm alone. On FX, adapting the blend beat a static equal-weight average specifically on M15 and lost to it on H1 - a pattern that held on both EURUSD and GBPUSD, though those are two correlated USD pairs, not two independent confirmations. On gold, the blend mode was nearly irrelevant next to whatever actually drove the near-total drawdown - sizing is one plausible contributor among several, not an established cause.
The learning-rate sweep added a second finding, with a qualifier attached: on the one EURUSD M15 combination tested, a rate roughly half the theoretical value cut net loss by roughly 4.1x, in a clean, single-peaked relationship rather than noise - but that sweep ran and was interpreted in-sample, on the same data already used to show Hedge's edge, so it demonstrates that eta matters more than it proves which value is universally better. Neither of these results supports a blanket "adaptive beats static" story, and neither supports dismissing adaptive blending either. What they do support is testing the blend mode and the learning rate separately, on your own instrument and timeframe, out-of-sample where possible, before trusting either theoretical default - which is exactly the matrix this article ran to find that out.
None of the eighteen runs above were profitable as shipped, and I'd rather say that plainly in the closing paragraph than let a reader discover it three sections later. What was proven is narrower and, I think, still useful: the mechanism works exactly as the math says it should - weights genuinely track realized accuracy, bar by bar, with no hand-tuned regime logic anywhere in the code - and the two things worth testing before you'd trust an ensemble like this on your own instrument (which blend mode, and what learning rate) both turned out to matter, in ways that weren't obvious from the formulas alone. That's the honest scope of what eighteen real backtests and a forty-pass sweep can actually tell you, and it's more than a single untested backtest on one symbol ever could.
Attached files
| File | Description |
|---|---|
| HedgeEnsemble_EA.mq5 | The Expert Advisor - OnInit indicator setup, OnTick vote collection and trade logic, ExecuteTrade order sizing and submission, OnDeinit/OnTester cleanup. |
| HedgeEnsembleLib.mqh | Shared include: the five vote functions, HdgDonchian, the CHedgeEnsemble multiplicative-weights class, and the risk/file helpers (HdgMinStopDistance, HdgCalcSafeLot, HdgEnsureFilesFolder, HdgIsNewBar). |
| HedgeEnsemble_WeightView.mq5 | The companion indicator - reads the live EA's published weights via GlobalVariableGet and plots them as a sub-window line chart. |
| MQL5.zip | All three files above, packaged under the standard MQL5\Experts, MQL5\Include and MQL5\Indicators folder structure - extract to your terminal's MQL5 folder and compile. |
Warning: All rights to these materials are reserved by MetaQuotes Ltd. Copying or reprinting of these materials in whole or in part is prohibited.
This article was written by a user of the site and reflects their personal views. MetaQuotes Ltd is not responsible for the accuracy of the information presented, nor for any consequences resulting from the use of the solutions, strategies or recommendations described.