Brokey For Amibroker
| Feature | Description | |---------|-------------| | Volatility adjustment | Uses ATR to normalize raw price changes. | | Mean-reverting zones | Extreme values (+2 / -2) suggest overbought/oversold. | | Divergence capability | Can show hidden/regular divergences with price. | | Multi-timeframe ready | Can be adapted for higher/lower timeframes. | | No repainting | Proper AFL implementations avoid future bias. |
// Simple Brokey-like check: flags bars with non-positive or NaN close
bad = (Close <= 0) OR IsNull(Close);
if (LastValue(Sum(bad, BarCount)) > 0)
printf("%s has %d bad bars\n", Name(), LastValue(Sum(bad, BarCount)));
Use Brokey > 0 to filter only long breakout signals (e.g., channel breaks, moving average crosses).
Symptom: The backtest sells instantly at the delist price. In reality, when a stock is broken, it often halts trading. You cannot sell. Fix: Modify your Brokey CBI to impose a random slippage of 50-100% on delisted trades. Or, treat the position as zero – you lose all capital and cannot exit. brokey for amibroker
// Brokey Indicator for AmiBroker Period = Param("Lookback", 14, 5, 50, 1); ATRPeriod = Param("ATR Period", 14, 5, 50, 1); Mult = Param("Multiplier", 1.5, 0.5, 5, 0.1);RawBrokey = (C - Ref(C, -Period)) / (ATR(ATRPeriod) * Mult); Brokey = EMA(RawBrokey, 3); // Optional smoothing
Plot(Brokey, "Brokey", colorBlue, styleThick); Plot(0, "Zero", colorBlack, styleDots); Plot(2, "Overbought", colorRed, styleDashed); Plot(-2, "Oversold", colorGreen, styleDashed); // Simple Brokey-like check: flags bars with non-positive
// Buy/Sell signals Buy = Cross(Brokey, 0) AND Brokey > Ref(Brokey, -1); Sell = Cross(0, Brokey) AND Brokey < Ref(Brokey, -1);
PlotShapes(Buy * shapeUpArrow, colorGreen, 0, Brokey); PlotShapes(Sell * shapeDownArrow, colorRed, 0, Brokey);Use Brokey > 0 to filter only long breakout signals (e