Support Board
Date/Time: Tue, 03 Dec 2024 17:56:57 +0000
[Programming Help] - ACSIL PriorPositionQuantity question
View Count: 70
[2024-11-29 00:57:33] |
User745789 - Posts: 326 |
Automated Trading From an Advanced Custom Study: [Type: integer] PriorPositionQuantity I am so happy to have found PriorPositionQuantity as it is exactly what I need to solve a problem in my trading script. if(PositionData.PriorPositionQuantity == 0) {
... place orders... } I don't want my script to place any orders if there has been any prior positions. But I have uncertainty about replay vs live trading. In replay, trade data is cleared for the symbol and the account. So .PriorPositionQuantity will always == 0 and the code works for the first order of the session (when there has been no trades) However in live trading: will .PriorPositionQuantity be <> 0 if there was a trade yesterday, in the previous session? What I want to do is test if there has already been a trade in this current session only. SC is restarted between sessions, if that matters. Date Time Of Last Edit: 2024-11-29 02:48:45
|
[2024-11-29 22:16:43] |
Sierra_Chart Engineering - Posts: 17332 |
will .PriorPositionQuantity be <> 0 if there was a trade yesterday, in the previous session? This depends upon the order fills loaded in the chart. All of the available fills for the Symbol and Trade Account will be loaded in the chart. So you really need to clear them:Trade Activity Log: Clearing Trade Activity Data Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2024-11-29 23:59:47] |
User745789 - Posts: 326 |
I thought this would be the case. I do y want to clear the trade log at the start of each session. Unfortunately I will gave to find another way to limit entry order placement to once per session. Is there anyway to refer to the date of the last trade in the log and test if it is the same as the current bar date? Then I would block entry order placement if it is. I could also use the current system time to the second to control when an order is placed, rather than the duration of a 15 minute bar. |
To post a message in this thread, you need to log in with your Sierra Chart account: