Login Page - Create Account

Support Board


Date/Time: Tue, 06 May 2025 20:39:27 +0000



[Programming Help] - ACSIL: limit of one entry per session

View Count: 231

[2024-12-03 05:36:09]
User745789 - Posts: 377
I only want to place a set of entry orders once in each session, at a certain time. The problem is that I use 15 minute bars and so the time condition for order placement remains true for 15 minutes. So if a trade enters and also exits within that 15 minutes, my script will try and place another entry order. I do not want this to happen. I am eager for suggestions. Here is what I have tried/considered, but each has a problem.

Solution 1. Restrict entry orders to when this is TRUE PositionData.PriorPositionQuantity == 0
Problem: this works in SIM replay when the account is cleared before replay. But in live trading, if there was a trade in the log from yesterday, it will not be true, and therefore today will not get any entry orders. The unworkable solution is to clear the trade log before the start of every session. I need a way to refer to PriorPositionQuantity for the current session only.

Solution 2. Use sc.CurrentSystemDateTime and set it to the second. When that second occurs, place entry orders. Once that second passes, no entry orders can be placed.
Problem: I travel so often that my laptop timezone is always changing. Solution: use a VPS.

Solution 3. Use a second chart. Then set entry to a certain time accurate to the second.
Problem: my understanding is the bar time only exists when a trade takes place in SC. If no trades happen in that specific second, then that bar will be skipped and my entry orders will not be created.

Any other suggestions?
Date Time Of Last Edit: 2024-12-03 05:56:59
[2024-12-03 10:23:52]
User431178 - Posts: 663
Query the trades list to find the date/time of the last trade.
Automated Trading From an Advanced Custom Study: sc.GetTradeListEntry()

Check the last entry date/time via the position data.
Automated Trading From an Advanced Custom Study: [Type: SCDateTime] LastEntryDateTime
[2024-12-04 03:10:42]
ondafringe - Posts: 322
You could also create a global boolean variable, something like newBar. Set newBar to true on the bar prior to your trade time bar. Add the newBar condition to your trade time condition. When you make the trade, set newBar to false.
Date Time Of Last Edit: 2024-12-04 03:34:25
[2024-12-04 23:58:17]
User745789 - Posts: 377
Thank you for these ideas.

I am struggling to implement any of these ideas - I can't do either so far - I am a beginner. But my bigger concern is I want a future version of the script to pyramid trades (add to them) and also reverse positions. And that means more than one entry in one session.
Date Time Of Last Edit: 2024-12-05 00:03:55
[2024-12-05 02:53:17]
User61168 - Posts: 442
at a certain time.
You might be over-complicating this by using ASCIL. This can be achieved via simple alert trading condition study regardless of which timeframe or chart type you are using.
[2024-12-05 02:56:08]
User745789 - Posts: 377
Understand, but I want it automated in many markets while I am asleep.
[2024-12-05 03:20:31]
ondafringe - Posts: 322
@User745789

You're getting way ahead of yourself. You have a LOT to learn. Start with the basics of coding first, followed by building simple, custom studies. Then, little by little, work your way up to building more robust studies to automate trading. But be prepared because it's going to be a time-consuming, head-banging, learning experience. :)

BTW, if you ultimately plan on using your custom study on multiple charts, then disregard what I previously said about using global variables.
Date Time Of Last Edit: 2024-12-05 03:40:04
[2024-12-05 03:47:10]
User745789 - Posts: 377
Thank you. I have started a C++ online course. It has helped a little so far.

You're getting way ahead of yourself

The problem is I have a solid history of coding trading systems using EoD bars and very simple plain English scripting "languages", and I can create almost anything I can think of so long as it doesn't require looping. Now I have moved onto ACSIL, and I am conditioned to be able to do anything, but suddenly can do almost nothing. I have actually finished a working ACSIL strategy. Now I am trying to enhance it with pyramiding and reversals - things I can not easily do in a spreadsheet.
Date Time Of Last Edit: 2024-12-05 03:48:47
[2024-12-05 04:20:22]
ondafringe - Posts: 322
Tutorial For Building Your First Sierra Chart C++ Custom Study

https://www.youtube.com/watch?v=bgOeFdrlukU
[2024-12-05 04:28:57]
User745789 - Posts: 377
That was where I started. The three in the series have been the most useful thing I have found on ACSIL :)
[2024-12-05 04:33:36]
User61168 - Posts: 442
Understand, but I want it automated in many markets while I am asleep.
you are only limited by total number of charts your platform can open (which is unlimited!). anyways, good luck with your journey to learn ASCIL. It's going to be long imo.
Date Time Of Last Edit: 2024-12-05 04:34:36

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

Login

Login Page - Create Account