Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 10:07:59 +0000



[Programming Help] - Spreadsheet backtest/automated trading question: Exit or Cancel based on # of bars

View Count: 788

[2018-01-10 06:33:27]
jackbravo - Posts: 65
Hello,
I'm learning to use the spreadsheet to test out strategies.

1. Is there a way to cancel open orders if let's say 5 bars have passed and the order remains unfilled?

2. Is there way to exit based on the number of bars that have passed since entry (filled order)?

Thanks!
[2018-01-10 07:35:09]
Sierra Chart Engineering - Posts: 104368
How to do this with the Spreadsheet System for Trading study is not within the scope of our support but doing things like this with ACSIL is reasonably possible using functions like this:
sc.GetBarsSinceLastTradeOrderEntry()
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-01-10 13:42:19]
Sawtooth - Posts: 3976
The way to do this with the Spreadsheet System for Trading study is to use a Formula Column to count bars since an event, like an entry signal in K3.

Use a formula like this, e.g. in P3:
=IF(M3,0,IF(OR(K3,P4>0),P4+1,P4))

This formula also turns it off if there is a signal in the opposite direction.
[2018-01-31 21:24:59]
Sierra Chart Engineering - Posts: 104368
We are also working at formal documentation with a lot of these examples from Tom showing how to do this.

Should be out in a few days.
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

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

Login

Login Page - Create Account