Login Page - Create Account

Support Board


Date/Time: Tue, 30 May 2023 04:28:07 +0000



Inconsistent Position Data: sc.GetTradePosition() returns Qty=1, Avg Price = 0.0 ??!!

View Count: 1005

[2014-01-28 12:13:32]
Israel Gottlieb - Posts: 14
I'm using the "Trading Example" autotrade code in the tradingsystem.cpp file you provide. It is the simplest one [entry on MA crossover, exit when stop offset or target offset hit; no attached orders]. I've made no changes to the code. I applied it to an E-mini intraday chart, and ran Bar Backtests and Replay Backtests. I tried the Bar Backtest also w/ historical data. In all cases, on the study calculation cycle immediately following a fill, the position struct s_SCPositionData comes back with qty=1, avg price = 0.0. The result is that the target is immediately filled on that same cycle -- because any price is much greater than 0.0. Consistent with this strange behavior, the Trade Activity shows all entries are exited exactly 1 tick away from the entry price, regardless of the Stop/Target inputs that are used. What is going on?? (Using version 1070. Note: I tried the next 2 autotrade examples in the file -- they work as expected.)

I posted a related question a couple of days ago, w/ Title: "Trying to Understand ASCIL Trading / Trading Example" -- but received no reply so far. Since then I've isolated the problem more exactly -- as above, so I posted again.

Would appreciate any guidance,
I. Gottlieb

[2014-01-29 02:05:44]
Sierra Chart Engineering - Posts: 104368
To understand fill prices, refer to this section here:
http://www.sierrachart.com/index.php?l=doc/doc_TradeSimulation.php#HowOrdersAreFilled

We will check on the Trade Position average price value.
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2014-01-29 07:27:23]
Israel Gottlieb - Posts: 14
I have read your documentation -- it is clear and straightforward.

However, I would think a Position w/ qty=1 & avg price = 0.0 just doesn't make sense. Further, the Trade Activity verifies that this is exactly what's happening -- because positions are always exited 1 tick away from entry, i.e. any price is way above the target offset -- since entry was at zero.

Looking forward to your reply,
IG
[2014-01-29 07:35:09]
Sierra Chart Engineering - Posts: 104368
However, I would think a Position w/ qty=1 & avg price = 0.0 just doesn't make sense
As stated in post #2, we said we would look into the Trade Position Average Price value. And we have and it is resolved in 1086 but we are doing some more review.

The problem was the result of performance optimization that was done about six months ago.
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account