Support Board
Date/Time: Fri, 29 Nov 2024 04:36:01 +0000
Post From: sc.GetTradePosition() : from where does it get the data?
[2023-03-10 17:37:52] |
User90125 - Posts: 715 |
Also review this page carefully: Automated Trading From an Advanced Custom Study: sc.GetTradePosition The s_SCPositionData::PositionQuantity is updated when an order fill occurs in Trade Simulation Mode or is received from the external Trading service. Therefore, in the case of non-simulated trading, there is not an immediate update. Only when an order fill occurs.
Not sure if this is concurrent with what Engineering just posted above though. In any event, you'll want to make sure that sc.MaintainTradeStatisticsAndTradesData is enabled in the SetDefaults block as well: if (sc.SetDefaults) { // Set the configuration and defaults ... //This should be set to true when a trading study uses trading functions. sc.MaintainTradeStatisticsAndTradesData = true; return; } |