Brokey For Amibroker Free -

// Before entering a trade BrokeyRisk = ExRem(BrokeyRisk, False); if( Buy AND NOT BrokeyRisk ) // Only enter if stock isn't on the "about to die" watchlist SetPositionSize( 2, spsPercentOfEquity );

This prevents your backtest from cheating by buying micro-caps that you could never fill in real life. Even with Brokey, users make mistakes. Here are the top three: Pitfall 1: Incomplete Delisting Dates Symptom: Your Brokey script sells at $0.01, but the stock actually traded for two more weeks at $0.05. Fix: Ensure your delisting data includes the last tradeable date , not the administrative delist date. Use a data provider that offers “last regular trade quote.” Pitfall 2: Ignoring Trading Halts 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. Pitfall 3: Overlapping Brokey Signals with Position Limits Symptom: Your system holds 10 stocks. Three go bankrupt on the same day. The backtest sells them all at the same time, ignoring liquidity. Fix: Add a MaxDelistedPerDay = 1 rule in the custom backtester. Force sequential liquidation at bid prices. This mimics real market chaos. Part 7: Tools & Resources for Brokey Data To implement Brokey for AmiBroker, you need data. Here is where to find it:

Pay for Norgate if you are serious. It includes the “Delisted Flag” as a built-in field. Then, use Brokey scripts to handle the response to that flag. Part 8: Real-World Example – The Brokey Difference Let’s run a thought experiment. Strategy: Buy any stock that has doubled in the last 20 days (momentum). Hold for 60 days. brokey for amibroker

Set up Brokey today. Import those delisted files. Watch your backtest suffer—and then, when you see a strategy that survives the Brokey gauntlet, you will know you have found something real. That is the power of rigorous backtesting.

adds a pre-backtest routine:

// JavaScript for AmiBroker Custom Backtester for each trade in Backtest.Trades if (trade.Symbol.IsDelisted && trade.ExitDateTime >= trade.Symbol.DelistDate) trade.ExitPrice = trade.Symbol.DelistPrice; // e.g., 0.01 trade.ExitReason = "Brokey - Delisted"; trade.RealizedPnL = -trade.EntryValue; // Total loss

Introduction: The Hidden Flaw in Your Backtests If you have spent any time developing trading systems in AmiBroker, you know it is one of the most powerful, flexible, and fastest backtesting platforms available. You’ve meticulously coded your entry signals, optimized your stops, and watched your equity curve climb steadily. But there is a silent, pernicious enemy lurking in your data that can turn your million-dollar strategy into a live-market disaster. // Before entering a trade BrokeyRisk = ExRem(BrokeyRisk,

This overrides AmiBroker’s default assumption that you can always sell at the close on the final bar. In your AFL code, add a Brokey risk filter:

COPYRIGHT © 2009-2025 ITJUSTGOOD.COM