Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 16:40:41 +0000



[User Discussion] - Open trade at next candle open

View Count: 367

[2024-02-18 16:12:22]
User744218 - Posts: 15
Asking a basic question but could not find it after searching the forums-

How do you open a trade at the next Candle Open?

Thanks so much!
[2024-02-18 21:28:05]
emmanuel - Posts: 58
To do that you need to know two things:

1. The index of the "next" candle.
2. The index of the current candle.

The index of the current candle is:
sc.Index
Naturally, the index of the next candle is:
sc.Index + 1

However, you need to store/remember the index of the next candle before the next candle opens. That's because if you wait until the next candle, then sc.Index would be the next candle and sc.Index + 1 would be the following candle. In other words, the moment in time during which you determine the "next" candle, matters. I hope that makes sense.

Here's how to approach this:

1. Create an integer persistent variable, and initialize it to a value that's not a valid index, such as -1.
2. When the conditions to enter on the next candle open are satisfied, set the persistent variable to sc.Index + 1.
3. Use an if-then block to check if sc.Index is equal to the persistent variable. If so then the next candle has formed; Open the trade and reset the persistent variable to -1.

See Persistent Variable Functions
[2024-02-18 21:38:06]
User744218 - Posts: 15
Thank you, Emmanuel. I appreciate you explaining the next candle Index timing point.

I assume this approach cannot be done using the the trade window settings.

Just wondering if this approach will work for Renko charts. May have to try it out.
[2024-02-18 21:55:26]
emmanuel - Posts: 58
Regarding the trade window, I'm honestly not sure. I know it's possible to programmatically change between trade window configurations, and I believe it's possible to programmatically set the order qty in the trade window. But I don't know how to trigger a trade using the trade window from ASCIL; I always create the orders entirely in ASCIL.

As for Renko charts, yes, the same technique works. The index identifies each bar, regardless of whether the chart is based on time, volume, price range, etc. For example, index 0 refers to the left-most bar on the chart; The first bar when you scroll all the way to the left. Where as sc.Index refers to the current bar.
[2024-02-19 17:06:02]
John - SC Support - Posts: 36249
What tool are you using to create the trade? And what are the conditions you want in order to have the order put in when the next bar opens?
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-02-19 17:57:46]
User744218 - Posts: 15
John, I am using the Trade window for Chart.

Chart: Flex Renko
Condition: If the candle is above the MA, then open BUY when the next candle opens.

THank you!
[2024-02-19 21:15:10]
John - SC Support - Posts: 36249
There is not a way to automate this directly from the Trade Window. You would need to use a tool like the "Trading System based on Alert Condition" or the "Spreadsheet System for Trading". Or, of course, you can enter it manually, but then we do not know what your question here would be.

For the "Trading System based on Alert Condition", which may be the easier one to use in this case, you would enter the following condition:
=C[-1] > ID1.SG1[-1]

This checks if the Close of the previous bar is greater than the MA (set here as ID1, but may be different in your setup) at the previous bar. As such, this would cause the current bar to open a position.

Refer to the following:
Trading System Based on Alert Condition
For the most reliable, advanced, and zero cost futures order routing, use 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