0

Brokey For Amibroker

  • Interpretation:

  • Optimization (Parameters):


  • 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

    The manual way to check for "Brokey" data is to open the Quote Editor (Symbols -> Edit). Scroll through your data. Do you see dates missing? Do you see 0 or Null values in the Volume column? This is tedious for one stock and impossible for a database of 2,000 symbols.

    By: Systems Trading Lab
    Published: October 26, 2023 Interpretation:

    Even with Brokey, users make mistakes. Here are the top three:

  • Restart AmiBroker (or press Tools → Reload Formula).
  • Open the Brokey AFL from Charts or Analysis window.
  • In your AFL code, add a Brokey risk filter: Optimization (Parameters):

    // 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 );
    

    Additionally, use StaticVarGet to track an external “Brokey Score” for each ticker (based on debt-to-equity or price < $1 for 30 days).