Support Board
Date/Time: Mon, 25 Nov 2024 05:36:03 +0000
[Programming Help] - Position Quantity during replay is always zero?
View Count: 349
[2023-10-08 20:34:08] |
j4ytr4der_ - Posts: 938 |
Can't figure out what's going on here, but I'm always getting zero for my position quantity during replay, despite the Chart Statistics tab of the TAL and the Trade Window both showing the correct position quantity. The Trade Positions window however, always shows no position. I've scoured the documentation, read many threads, done tons of googling, but I'm still stuck. My simple code: s_SCPositionData PositionData; sc.GetTradePosition(PositionData); double PositionQuantity = PositionData.PositionQuantity; if(PositionQuantity == 0){ Subgraph_debug[sc.Index] = 1234; // This is just so I can see that the code does execute SCString Message1; Message1.AppendFormat("PositionQuantity: %f", PositionQuantity); sc.AddMessageToLog(Message1, 1); } Strangely however, Subgraph_debug is in fact set to 1234, so I know the code execution got there. But my message log gets nothing written to it. Any input on what's going on here? |
[2023-10-08 22:15:54] |
j4ytr4der_ - Posts: 938 |
Well I don't understand why, but quitting & relaunching SC appears to have cleared up the issue. I still only see positions reported in the Trade Positions window on live markets, not replay... I'm guessing that's expected behavior as everything else is now behaving as expected. Go figure.
|
[2024-03-26 22:15:32] |
ForgivingComputers.com - Posts: 960 |
Well I don't understand why, but quitting & relaunching SC appears to have cleared up the issue.
Join the club. These things happen occasionally, but cannot be reproduced. There is nothing you can do about it but to try restarting when things don't work and you cannot otherwise determine why. One I see frequently is having to close a chartbook I was debugging in VC, but it sat overnight. |
[2024-03-27 02:53:01] |
ertrader - Posts: 672 |
Something to try: Instead of: double PositionQuantity = PositionData.PositionQuantity; try: int PositionQuantity = PositionData.PositionQuantity; It's conceivable that a double may not be EXACTLY 0 but an int will make sure it is. Glad restarting worked. Also, you probably already do this but just to be sure.... before you compile, release the dll (release single dll and deny load) . After compiling, click allow load dlls. These options are in the Analysis/build custom studies/build menu. Date Time Of Last Edit: 2024-03-27 02:57:26
|
[2024-03-27 02:57:45] |
j4ytr4der_ - Posts: 938 |
Thanks, I've long since moved on from this, don't remember at the moment what I did about it but haven't been having any issues with position quantities anymore. As to releasing/loading the dll, as I understand it this hasn't been required for quite some time if you're building & running on the same SC instance. I never have to do this anymore unless I'm building in one instance, and testing in another. It's certainly been at least 6 months since I've had to do the release/load dance regularly. |
To post a message in this thread, you need to log in with your Sierra Chart account: