Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 20:31:53 +0000



Post From: CTS internal position data

[2013-05-15 12:15:28]
User35525 - Posts: 179
Dear SC,

Sim-trading is working but I'm still having trouble with CTS getting s_SCPositionData. Here is my use case: I'm using SC 971 and want to be out of the market at 3p.m. or if I'm losing too much money on the day, so have two studies.

One calculates on every tick and takes trades. The 2nd calculates continuously (sc.UpdateAlways = 1) because it needs to be out at 3p.m. and if my daily loss (open + closed profit) is too large. This latter study disables Autolooping (sc.AutoLoop = 0) because it's not filling any Subgraph[].Data[] arrays (this makes it run much faster too since I have several charts running the study). The documentation says another benefit to "sc.AutoLoop = 0" is that calls to sc.GetTradePosition will not produce an error. I'm also setting "sc.MaintainTradeStatisticsAndTradesData = 1" because I'm using s_SCPositionData.

If sc.GetTradePosition works with CTS, is the problem that I'm using a 2nd trade study on the same chart? The 2nd study calls "sc.GetTradePosition(PositionData)" and displays on-screen the chart's real-time nav, as well as global nav between all charts, then calls "sc.FlattenAndCancelAllOrders()" as-necessary. If trading is disabled, it sets a global variable so all trading studies know to not take trades until the next session. Everything works okay in sim-mode.

Best Regards,
Ted

Date Time Of Last Edit: 2013-05-15 12:30:00