Login Page - Create Account

Support Board


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



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

[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