Boom/Crash EAs: how do you protect a basket from the spike – hedge order, basket stop or cooldown?
Watch out with pending hedge stops on Boom/Crash: when a spike jumps in one tick, the stop order fills past the gap too, so it won't lock the gap.
Use a 90th percentile instead of the mean so outliers don't skew sizing, and test on real ticks only.
double moves[]; ArrayResize(moves, bars); for(int i = 1; i <= bars; i++) moves[i - 1] = MathAbs(iClose(_Symbol, PERIOD_M1, i) - iOpen(_Symbol, PERIOD_M1, i)); ArraySort(moves); double p90 = moves[(int)MathFloor(0.90 * (bars - 1))];
Thank you Margarita, both points are very useful.
You're right about the pending hedge. On a one-tick spike the stop fills at the far side of the gap, so it limits the damage after the spike but can't lock the loss at the gap. I'll treat it as a "stop the bleeding" tool, not real protection, and size each basket so that one full spike plus the hedge slippage still stays inside the basket stop.
The 90th percentile makes a lot of sense. The average gets pulled up and down by a few huge spikes. I'll also separate the spike candles from normal drift candles before sorting, so the normal M1 bodies don't drag the value down.
I'll test on real ticks and compare the tester results with a few weeks of demo logs, to see how big the gap between them really is.
Adding to Margarita's points (percentile sizing and pending-stop slippage), three things that helped in testing:
1. Testing spikes: real-tick history for synthetics is thin, so record ticks on a demo account for a few weeks (a small script with CopyTicksRange saving to a file), load them into a custom symbol with CustomSymbolCreate and CustomTicksAdd, and test on that. You see the gaps as they really happened, and you can replay the same spikes after every code change.
2. Separating spikes from normal bars: define a spike as an M1 bar whose range is above k x the median range of non-spike bars, then take the percentile of the spikes only. Otherwise ordinary bars dilute the sample, especially on Boom/Crash 1000 where spikes are rare.
3. Right after a spike, spreads widen and fills slip, so alongside the cooldown check the spread and set a deviation limit before the next entry.
Whatever you settle on, run it on demo for a good while before live: a live spike can be bigger than anything in your sample.
Hello everyone,
I've been building an EA for Boom and Crash indices on MT5, trading the drift between spikes. The entries are the easy part. The hard part is surviving the spike itself, because it can move hundreds of points in one tick and jump straight past a normal stop loss.
These are the protections I'm testing at the moment:
1. Spike size learned from the symbol. On start, the EA scans the last 24 hours of M1 candles to measure the average spike size, instead of using a fixed number that is wrong on Boom 500 vs Boom 1000.
2. Pending hedge order. A stop order in the spike direction, placed a short distance away, so a spike opens a hedge instead of only hitting the stop.
3. Basket stop in money, plus a daily loss limit, so one bad spike can't take the whole account.
4. Cooldown after a spike. No new entries for a number of bars, because the price is often unstable right after.
5. Netting accounts: the hedge is disabled automatically, so the EA relies only on the basket stop.
Questions for other developers:
- Do you use a hedge order, or do you rely only on the stop loss and accept the slippage?
- How do you measure "normal" spike size: average, median, or a percentile of recent spikes?
- Have you found a reliable way to test spike behaviour in the Strategy Tester? Real ticks for synthetics are limited, so the test results can look much better than live trading.
Interested to hear your experience.
Thank you.