First, let’s clarify terminology. “Brokey” is colloquial trading slang for a stock that is financially distressed, has been delisted, or has gone bankrupt. In the context of AmiBroker, Brokey refers to two things:
Most retail traders download a “Nifty 500” or “S&P 500” historical database. That database, by default, only contains stocks that are currently in the index. If a stock went bankrupt in 2008, it is no longer in the index, and thus, it magically disappears from your backtest. Your system will never suffer that -90% loss in simulation, but it will in real trading.
Brokey for AmiBroker forces your system to experience the painful reality of delisted stocks.
Amibroker is renowned for its speed, flexibility, and powerful backtesting engine. However, its native charting—while functional—often leaves traders wanting more in terms of visual clarity, annotation tools, and dynamic levels. Enter Brokey. brokey for amibroker
Brokey is a free, open-source script and toolset designed to dramatically enhance Amibroker’s charting interface. It bridges the gap between raw data and actionable visual insights, offering features typically found only in premium platforms like TradingView or Sierra Chart.
In this article, we’ll explore what Brokey is, why it has become indispensable for many Amibroker power users, and how to get started.
// 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 First, let’s clarify terminology
Plot(Brokey, "Brokey", colorBlue, styleThick); Plot(0, "Zero", colorBlack, styleDots); Plot(2, "Overbought", colorRed, styleDashed); Plot(-2, "Oversold", colorGreen, styleDashed);
// 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);Most retail traders download a “Nifty 500” or
Use Brokey > 0 to filter only long breakout signals (e.g., channel breaks, moving average crosses).