Support Board
Date/Time: Fri, 29 Nov 2024 04:34:26 +0000
[Programming help] How to exit any position after 20 bars since it's opened using ASCII?
View Count: 307
[2023-03-10 12:07:57] |
User395175 - Posts: 87 |
Hi, i want my programme exit the position after a fixed number of bars (like 20), how can i do it? I will have multiple positions open at the same time, for each, i want it to be closed after 20 bars since it opened. I saw there is a sc function called sc.GetBarsSinceLastTradeOrderEntry(), but it only consider the last trade. i don't think i can use it in my case. Please help me, thank you. |
[2023-03-10 14:14:18] |
User268846 - Posts: 17 |
you can store the order id and entry bar index for each order and then check if they are expired or not each bar
|
[2023-03-10 14:17:03] |
User268846 - Posts: 17 |
... assumed you use market orders for entry ...
|
To post a message in this thread, you need to log in with your Sierra Chart account: