Hi, I have a risk trigger(run at minute 45 hourly) schedule that will liquidate my position if a drawdown exceeds 10%. The trigger was activated to liquidate at 14:00 and here is the log
2023-02-13 14:00:00 *** RISK MANAGEMENT TRIGGER (HOURLY MONITORING) ***
2023-02-13 14:00:00 Drawdown from peak exceeded: 11.56% > 10.00%
2023-02-13 14:00:00 Position peak was $5,306.19
2023-02-13 14:00:00 Current value: $4,692.54 (dropped $613.65 from peak)
2023-02-13 14:00:00 Liquidating all positions to protect capital
2023-02-13 14:00:00 Portfolio before: $10,553.10
2023-02-13 14:00:00 Liquidation complete - peak-based risk management
2023-02-13 14:00:00 Portfolio after: $10,553.10
2023-02-13 14:00:00 Liquidation impact: $0.00
2023-02-13 14:00:00 Cash available: $5,860.56
2023-02-13 14:00:00 High water mark reset for fresh startHowever,
the OnOrderEvent does not trigger until 16:00
=== Order Filled #12 ===
2023-02-13 16:00:00 Date: 2023-02-13
2023-02-13 16:00:00 Symbol: TQQQ
2023-02-13 16:00:00 Quantity: -197.0
2023-02-13 16:00:00 Price: $24.14
2023-02-13 16:00:00 Direction: Sell
2023-02-13 16:00:00 New Position Value: $6387.20
2023-02-13 16:00:00 Current TQQQ Position: 256.0 shares, Holding 6387.20 Value: $6387.20
2023-02-13 16:00:00 Current SQQQ Position: 0.0 shares, Holding 0.00 Value: $0.00
2023-02-13 16:00:00 Trade P&L recorded: $63.04 for scaling_TQQQ
2023-02-13 16:00:00 Unrealized P&L: $695.42
2023-02-13 16:00:00 Volume Ratio: 0.00x average
2023-02-13 16:00:00 ======================
I have another schedule that will perform check and trade daily at 15:30 and that trade is filled as following:
=== Order Filled #11 ===
2023-02-13 16:00:00 Date: 2023-02-13
2023-02-13 16:00:00 Symbol: TQQQ
2023-02-13 16:00:00 Quantity: 256.0
2023-02-13 16:00:00 Price: $23.82
2023-02-13 16:00:00 Direction: Buy
2023-02-13 16:00:00 New Position Value: $10790.46
2023-02-13 16:00:00 Current TQQQ Position: 453.0 shares, Holding 10790.46 Value: $10790.46
2023-02-13 16:00:00 Current SQQQ Position: 0.0 shares, Holding 0.00 Value: $0.00
2023-02-13 16:00:00 Position high water mark updated: $4,692.54 -> $10,790.46 (+$6,097.92)
2023-02-13 16:00:00 Unrealized P&L: $718.67
2023-02-13 16:00:00 Volume Ratio: 0.00x average
2023-02-13 16:00:00 ======================its order executed before my liquidation order as it indicates #11 in log.
Why does my liquidation order delay the order fill until 16:00?
Thank you
The Futures Trader
Hi Cong,
Could you share how you're adding the ETF to your universe? The syntax should look like this:
I suspect the extended market hours setting might not be enabled. You'll need to add this before creating your universe:
According to the QuantConnect documentation, extended market hours data is only available with intraday resolutions (like Resolution.Minute or Resolution.Second). If you're using Resolution.Daily, the bars will only reflect regular trading hours, regardless of the extended hours setting.
Let me know if this helps or if you need any clarification!
Greetings,
Jordy
Cong Nguyen
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!