Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 02:51:57 +0000



Post From: ACSIL PriorPositionQuantity question

[2024-11-29 00:57:33]
User745789 - Posts: 343
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