Login Page - Create Account

Support Board


Date/Time: Wed, 17 Jul 2024 11:35:03 +0000



[Programming Help] - How can I add a delay before a trade decision is made in Spreadsheet for Trading study?

View Count: 167

[2023-11-20 12:09:02]
User370531 - Posts: 49
I'm trading two stocks, symbol A and symbol B, using separate strategies under one account. Each stock is on a different chart in a chartbook and linked to unique sheets in the same trading spreadsheet. I want to manage their risks independently.

Here's my method: I use a new sheet to determine how many contracts to buy for each stock based on the account's value. For example, I decide to buy 10 contracts of A and 15 of B. When a trade for A is initiated, the system is set to temporarily stop trading for B by setting its contract count to zero. This prevents B from trading until A's trade is complete. However, if both stocks trigger trades at the same bar close, they both execute before the spreadsheet can update and pause the other.

How can I solve this problem? A brief delay (1 second) between trades should give the spreadsheet study time to adjust the contract numbers for B after A's trade, preventing simultaneous trades. Is there a way to do this?
[2023-11-20 16:42:10]
Sawtooth - Posts: 4048
Maybe you could set symbol B to an intrabar entry 1 second beyond the Open.
=AND(YourEntryConditions,$J$41>=A3+1/86400)

Or require the difference between A's J41 and B's J41 to be >= 1 second:
=ABS(Sheet1!J41-Sheet2!J41)>=1/86400
[2023-11-20 21:07:54]
User370531 - Posts: 49
Beautiful, thank you

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

Login

Login Page - Create Account