VeighNa Trade Callbacks, Position Tracking, and a Multi-Stage Stop Strategy
Summary
This forum post presents a VeighNa CTA strategy for futures that combines moving-average crosses, TEMA direction, and MACD, with tick-based dynamic stops. The stop logic progresses from a fixed loss threshold to a stop near breakeven after a profit threshold, then to a trailing exit that gives back a set share of maximum open profit. The code also tracks entry prices and positions in the fill callback, and discusses how to filter incomplete auction-period bars and defer trades around session boundaries.
The post’s main issue is an intermittent live-trading discrepancy: exchange fills and triggered stop orders are reported, but the author says the strategy’s trade callback sometimes does not run, leaving its recorded position unchanged. The example offers implementation details and a concrete debugging context, but it does not establish the cause or provide a verified fix. Platform, broker, order-state, and callback-delivery behavior may matter; the excerpt alone cannot determine why fills were missed or validate the stop logic in live trading.
Key ideas
- The sample strategy combines moving-average, TEMA, and MACD signals for futures entries and exits.
- Its dynamic stop logic moves from a fixed loss limit to a profit-protecting stop and then a trailing giveback rule.
- The code records entry prices and resets stop variables inside the trade callback.
- It filters selected bars and delays orders around auction periods and session boundaries.
- The reported problem is an intermittent absence of the trade callback despite exchange fills, with no confirmed diagnosis or remedy supplied.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.