Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 05:13:57 +0000



[Programming Help] - Spreadsheet system for trading stop limit flatten after triggered but not filled

View Count: 1072

[2018-02-15 18:11:22]
User393339 - Posts: 3
Hello, I am using the spreadsheet system for trading. I need to be able to use the J29-flatten and cancel working orders in the following manner: I need it to flatten by market order my position only if my stop limit is triggered but not filled and E3-current price goes below my stop limit. I have tried several ideas but I am unable to make anything work. If possible a formulation as how to achieve this would be very helpful.
[2018-02-16 18:50:00]
Sierra Chart Engineering - Posts: 104368
It is beyond the scope of our support to help put together the exact configuration within the Spreadsheet that you are looking for. But, we have created an example page of Spreadsheet formulas that may help you get started. You can find that page here:
Spreadsheet Example Formulas and Usage
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-02-16 23:02:06]
Sawtooth - Posts: 3993
If you are cancelling an unfilled order where there are no existing working attached orders, use cell J27.
If you are cancelling an unfilled order where there might be existing working attached orders, use cell J78.

If the StopLimit was triggered in one bar but always cancelled in a subsequent bar, you can create a persistent variable of the trigger price in a Formula Column, and find where E3 crosses below that price in another Formula Column and reference it in J27 or J78, referencing row 3 for a first-occurrence intrabar cancel, or row 4 for a close of bar cancel, like this:
P3:
=IF(K3,limitprice,P4)
Q3:
=CROSSFROMABOVE(E3:E4,P3:P4)
J78:
=AND(J4>0,Q4)

If you need to cancel an unfilled order in the same bar as it was triggered, in J27 or J78 try referencing J41 > J90 and J90 > A3 and E3 < J22.
Since this is intrabar, it can only be the first occurrence.
J78:
=AND(FRACTIME(J41)>FRACTIME(J90),FRACTIME(J90)>FRACTIME(A3),E3<J22)

These are untested examples, and you'll probably need to tweak them for your situation.

SC Support: This would be easier to do if there was a Last Entry/Exit Order Price (read-only) companion to the J90 Last Entry/Exit Order Date-Time (read-only). Would you consider adding this output to the Spreadsheet System for Trading study?
Date Time Of Last Edit: 2018-02-17 14:38:02
[2018-02-22 16:31:09]
User393339 - Posts: 3
@tomgilb, thank you for the response. I will apply the formula and see if it works, regardless your response was very helpful. Thanks!!!
[2018-05-23 04:02:25]
User651753 - Posts: 77
Last Entry/Exit Order Price (read-only) companion to the J90 Last Entry/Exit Order Date-Time (read-only). Would you consider adding this output to the Spreadsheet System for Trading study?
@tomgilb

How can you make it so it cancels all order after last order date-time j90

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

Login

Login Page - Create Account