Login Page - Create Account

Support Board


Date/Time: Tue, 06 May 2025 20:14:02 +0000



Trade Window Flatten and Cancel All Orders with fast replay

View Count: 252

[2024-12-05 02:07:50]
User745789 - Posts: 377
It appears to me that 'Trade Window - Flatten and Cancel All Orders' does not always work when replaying at higher speeds. Is that to be expected? Could this actually be a limitation of my hardware?
[2024-12-05 04:29:17]
Sierra_Chart Engineering - Posts: 19461
Where do you see this text:
'Trade Window - Flatten and Cancel All Orders'
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-05 04:42:45]
User745789 - Posts: 377
My use of parentheses was misleading. Sorry. I do not see that text as written.

In the Trade Window, M menu, Flatten Action, I see "Flatten and Cancel All Orders"
[2024-12-05 15:37:25]
John - SC Support - Posts: 39675
Are you actually selecting the "Flatten" button?

The items under the M menu for Flatten Action just control what the "Flatten" button does. It does not send a command itself.

What is the speed of the replay?
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-06 00:04:37]
User745789 - Posts: 377
Are you actually selecting the "Flatten" button?

No.

The flatten action is coming from an order. And in live trading, all working orders are cancelled on flatten (not using the button). It has always worked that way for me, and works perfectly in live trading.

But in fast reply, it appears not to work.
Date Time Of Last Edit: 2024-12-06 00:04:54
[2024-12-06 14:40:57]
John - SC Support - Posts: 39675
So you are saying that you have an OCO Group of working orders and in replay when one of the orders is hit, the position is closed by the opposing order is not removed?

Or if it is something else then we need the specifics of what exactly is occurring.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-07 01:02:37]
User745789 - Posts: 377
Not OCO group. Just unattached working orders that all cancel when the position is flattened.
[2024-12-07 17:39:47]
John - SC Support - Posts: 39675
An unattached working order will NOT close out other working orders. You would need to actually issue a "Cancel" command to close out the other working orders when one of them is hit that then closes out the position. If you are using a Custom Study, then you could program this into your study. But the trading systems in Sierra Chart (such as the Spreadsheet System for Trading) are not setup to do this.

We really do not understand how you have this working in live trading.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-08 00:57:01]
User745789 - Posts: 377
[quoteAn unattached working order will NOT close out other working orders. You would need to actually issue a "Cancel" comman][/quote]

I never said that. There is confusion here. It is very simple.

I have a position. I have an unattached stop and unattached take profit. If one is filled, the position becomes flat. And when flattened, all remaining working orders are cancelled. This is set in the M menu, via action on flatten. It works perfectly and it is ESSENTIAL to automated spreadsheet trading. I have to emphasize, it is vital.

Quite frequently, orders can not be attached, they simply can't be. So cancelling all working orders on flatten is vital. Please do not change it, it will ruin sierra auto trading.
[2024-12-09 16:18:56]
John - SC Support - Posts: 39675
And when flattened, all remaining working orders are cancelled. This is set in the M menu, via action on flatten

The above statement is incorrect. The "M >> Flatten Action" settings on the Trade Window determine the action of the "Flatten Button" on that same Trade Window. That is all. It does NOT define the action that is taken when a position is flattened.

Are you using a custom study or the Spreadsheet System for Trading for these trades? The reason we ask is that we wonder if what you are seeing is due to the following setting:
Automated Trading Management: CancelAllWorkingOrdersOnExit
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-10 00:24:56]
User745789 - Posts: 377
The above statement is incorrect. The "M >> Flatten Action" settings on the Trade Window determine the action of the "Flatten Button" on that same Trade Window. That is all. It does NOT define the action that is taken when a position is flattened.

I understand. However I have multiple instances of all working orders being cancelled when a position is flattened WITHOUT using the Flatten button. It happens every day. I have been using it that way for a long time. I just tested it in replay on a chart that didn't have a spreadsheet for trading, and where the orders were not OCO attached. I manually placed orders and all working orders where cancelled when the take profit order was hit and the position flattened.

HOWEVER: having said that, in replay I can find instances where it doesn't work perfectly - sometimes, not often, unattached working orders remain working when the position is flattened via another working order.

Are you using a custom study or the Spreadsheet System for Trading for these trades? The reason we ask is that we wonder if what you are seeing is due to the following setting:
Automated Trading Management: CancelAllWorkingOrdersOnExit

I do have numerous spreadsheets for trading operating. But I am not using that setting. I am only using Trade Window >> Menu >> Flatten Action. And it works in live trading every day.

However, from now on I will not use the trade window setting for action on flatten. I will use this setting in J27. When the position = 0 (J5=0) then cancel all working orders. Hopefully this will be foolproof in replay backtesting and live trading. Spreadsheet Systems, Alerts and Automated Trading: Cancel Working Orders [J27]

It is essential that there be some mechanism in spreadsheet autotrading to cancel all working orders when the position is flattened. And this method is not foolproof, as not all exits come from BuyExit or SellExit actions. https://www.sierrachart.com/index.php?page=doc/AutoTradeManagment.php#CancelAllWorkingOrdersOnExit. I am really hoping cell J27 is the best solution.

Thank you for your patience with this so far.

EDIT: please see attached "image A" from the Trade Log. This came from live trading. The only mechanism I had in place to cancel working orders on flat position is via Trade Window >> Menu etc. I promise, that is where this cancel action came from. It did not come from any setting in a trading spreadsheet.

Now please see "Image B". Same situation, but different product. In this instance SC tried to cancel working orders on flat position, but it was rejected. This was also live trading. What order state would prohibit the cancel request?
Date Time Of Last Edit: 2024-12-10 04:12:52
imageImage A.png / V - Attached On 2024-12-10 01:46:23 UTC - Size: 20.36 KB - 48 views
imageImage B.png / V - Attached On 2024-12-10 01:46:27 UTC - Size: 28.84 KB - 44 views
[2024-12-10 05:34:28]
User745789 - Posts: 377
I have identified the cause of the issue (orders not always being cancelled on flat). It was to do with my unique config between a spreadsheet and using attached orders. I will change my config to solve the problem.

But FYI, it remains true Trade Window >> Menu >> Flatten Action is indeed cancelling working orders when flatten comes from another working order, rather than the flatten button. Personally, I think this is a very functional feature, even if not designed that way.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account