Login Page - Create Account

Support Board


Date/Time: Tue, 06 May 2025 23:01:46 +0000



Post From: ACSIL: limit of one entry per session

[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