Skip to content

0.6.0

Choose a tag to compare

@chauduyphanvu chauduyphanvu released this 18 Nov 14:28
· 60 commits to main since this release

Short selling and leverage: a strategy can now go short, flip between long and short, and hold up to twice its equity, with a borrow fee, interest on borrowed money and margin calls. Results of existing strategies do not change: a block with no short rule and weights within 100% runs exactly as before.

  • Going short. short when and cover when rules sit beside buy and sell. A block can trade one side or both; with only a buy rule and a short rule, a ticker flips from long to short on the same signal, as in the new starter "Trend, long or short". A short's stop sits above its entry and its target below, and a trailing stop follows the lowest price. Each short pays a borrow fee for every day it is held, 0.5% a year unless a borrow fee line or the new setting says otherwise.
  • Leverage up to 2×. Weights and size can add up to 200%. Money borrowed pays interest, 6% a year unless a margin rate line or the new setting says otherwise. When equity falls below 25% of the positions' value at a close, a margin call closes everything at the next open; a run that loses all its equity ends there.
  • Results. For a block that shorts or borrows, the "Time invested" tile becomes "Exposure", gross with net beside it, and the result notes the borrow fees, the margin interest and any margin calls. Trades get a Side column, the price chart marks short sales and covers and shades the time held short, and "Explain this trade", the bar-by-bar table, the folded line, the dashboard, the trades CSV and note properties all say which side.
  • Orders and accounts. Today's orders, trigger prices and forward tests say "Sell short" and "Buy to cover", with a flip as its two orders. An account block can hold shorts (SPY -50) and cash below 0 when a strategy it follows can borrow, and gives "Flip" orders. Broker files read short sales and buys to cover, such as Schwab's "Sell Short" and "Buy to Cover" rows, as trades.
  • Checks. Luck checks keep each trade's side, regimes and crises show gross and net, and the cross-check against a second backtester gains eight short and margin cases, 44 in all.
  • Not yet. A ranking (hold: top 3 by …) can't also go short; a block with both says so. Hard-to-borrow lists, per-stock borrow rates and short-sale restrictions are not modelled.