Generating Exit Signals from the MabeKit Column Library
By Dave Mabe
Here's a reader question from Ryan (name used with permission, edited lightly for clarity)
Ryan:
What do you think about generating exit signals from the MabeKit column library? I currently place exit orders at the same time as my entry orders, but I see some situations where overriding those original exits based on technical indicators could be profitable. What are your thoughts?
Things I've considered:
Benefit: Possible increased profitability. I haven't tested it yet, though.
Risk: The short moment where the position is unprotected between canceling exit orders and placing a new market exit order.
Risk: Dependency on my system's uptime. Yeah, the position is still protected by the original exits, but it still introduces a new way for live trading to diverge from backtests.
Dave:
This depends heavily on how big the benefit actually is, which, of course, can be measured by backtesting.
But the benefit needs to be strongly in your favor to overcome the added complexity.
One of the things I love about the IBKR API and the orders there is that they are server-held.
That is, you can submit your entry and exit orders in a single batch, all activating at entry time.
This is exactly how the MabeKit Trade Client works with IBKR - there's literally no way you can have a situation where you're in a position, but your exit orders aren't active. (Which would be an enormous risk.)
Adding a new way to exit your trades based on client-side logic adds complexity (and risk) to your setup.
It could still be very much worth it, though.
The added P&L from the exit signal needs to be significant.
Here's how to backtest it in Amibroker.
Let's say you want to test a scenario where if Relative Volume crosses below a threshold during your trade, you exit early.
This column is in the MK column library as MK_RV, so you'd add a parameter to your AFL code to toggle the advanced exit on or off:
RV_Exit_Active = ParamToggle("Relative Volume Exit Active", "no|yes", 0); // inactive by default
Then later in your code:
if (RV_Exit_Active AND MK_RV < MIN_RV_THRESHOLD)
{
exit_reason = "RV_Exit";
} (more code needed, but you get the picture)
Then I'd run two backtests: one with the Relative Volume Exit Active enabled, one without.
Compare the results in aggregate.
Sort by the Exit Reason field to see the subset of trades that hit your new exit.
You could write a Python script to identify the trades where the RV exit occurred and compare the results trade-by-trade.
This should give you a clear picture of the benefits that you can weigh against the tradeoffs.
Great question, Ryan, and thanks for sharing with the list.
-Dave
P.S. If you're not automating your trades, you're missing out. Join the traders who have taken their trading to the next level with the Trade Client, included with MabeKit.