Support Board
Date/Time: Tue, 26 Nov 2024 23:40:13 +0000
[Programming Help] - Multiple Exit Spreadsheet Automated Trading Attached Order Issue
View Count: 476
[2023-10-02 11:19:55] |
User12222 - Posts: 20 |
Hi, I am using the Spreadsheet System for Trading, trading two contracts at a time, and I have 2 spreadsheet programed exits (Condition 1 and Condition 2). I am also using attached orders (Stop Loss for each contract = 2 attached orders) so Stop Loss orders are on the brokers server as a 'catastrophic stop loss'. Otherwise, the buy/sell engine and exits are programmed into the spreadsheet. I am having an issue with attached orders. When the first exit condition is reached, the first of two contracts is flattened. However, when this occurs, both of the attached stop loss working orders are canceled, instead of just the one that was closed by the spreadsheet exit, leaving me with a 'naked' contract with no stop loss order. When I use the spreadsheet for multiple exists, I have J26 = 2, J82 = 1, and J83 = 1. I also use logic for the Buy Exit (Sell) and Sell Exit (Buy) to peal off contracts one at a time with this logic =OR(AND(ABS($J$8)>1,(Condition 1))),AND(ABS($J$8)>0, Condition 2))). The exits do work when Conditions 1 and 2 are present. Again, I am looking to keep the 2nd attached order (Stop) when the first condition is executed and the contract is pealed off. Under Study Settings, the following are YES: Reset Condition on New Bar; Signal only once per bar; Cancel all orders on entries and reversals; Allow entry with working orders; Signal only on bar close (Line 17 and 18); Support reversals; Cancel working orders on exit; Strict Signal on Bar close evaluation; When I set the 'Cancel All working orders on exit' to NO, then the Buy Exit and Sell Exit conditions programmed into the spreadsheet do not trigger an exit. I am using version 2540 which is a newer version. If you need more detail please let me know. Thank you in advance for your time helping me resolve this issue. |
[2023-10-03 16:31:22] |
Sawtooth - Posts: 4120 |
Try these changes: - Set ''Signal only once per bar' to No. (You don't need this if Signal Only On Bar Close is Yes.) - Use 'Cancel all orders on reversals' instead of 'Cancel all orders on entries and reversals'. - If you are using Attached Orders with L3/N3 exits, 'Cancel working orders on exit' must be Yes. - Set 'Strict Signal on Bar close evaluation' to No. (This option can be overly sensitive.) - Check: Trade Window >> Main tab >> M button >> Orders >> 'Support Scale Out'. |
[2023-10-03 17:37:30] |
User12222 - Posts: 20 |
Sawtooth, Thank you for the post. I tried what you suggested but both attached Stop loss orders are still cancelling after the first contract peels off. Is there another way to complete the same actions? Peel off one contract out of two while still having the remaining stop loss working order in place? |
[2023-10-03 21:29:14] |
Sawtooth - Posts: 4120 |
Is there another way to complete the same actions?
I built a quick test spreadsheet autotrader to replicate your issue, and I get the same unexpected results: the scale out reduces the position, but leaves it naked without any attached orders. With autotrading disabled, I manually BuyMkt 2 contracts, then SellMkt 1 contract, it properly scales out without leaving a naked position. I don't have an answer for this unexpected behavior. Maybe SC Support will see this and comment. |
[2023-10-04 10:43:33] |
User12222 - Posts: 20 |
Sawtooth, Thank you for doing the test and letting me know. Yes - I hope SC support can help. |
[2023-10-10 14:04:55] |
User12222 - Posts: 20 |
Hello Sierra_Chart Engineering, Will this Attached Order issue be supported in the future? |
To post a message in this thread, you need to log in with your Sierra Chart account: