I am using an IB paper trading account to test this on EURUSD.
The pseudo-strategy I am using does generate trades correctly but the MarketPosition_At_Broker is always 0.
I am using the print command to watch MarketPosition and MarketPosition_At_Broker.
This is the kind of data I get in the output window:
Code: Select all
1/5/2010 9:36:15 AM : MarketPosition_at_Broker = 0
1/5/2010 9:36:15 AM : MarketPosition = -1
1/5/2010 9:38:00 AM : MarketPosition_at_Broker = 0
1/5/2010 9:38:00 AM : MarketPosition = -1
1/5/2010 9:40:05 AM : MarketPosition_at_Broker = 0
1/5/2010 9:40:05 AM : MarketPosition = -1
1/5/2010 9:42:01 AM : MarketPosition_at_Broker = 0
1/5/2010 9:42:01 AM : MarketPosition = -1
1/5/2010 9:44:03 AM : MarketPosition_at_Broker = 0
1/5/2010 9:44:03 AM : MarketPosition = 0
This is the pseudo-strategy I am using:
Code: Select all
SetStopPosition;
value1 = AverageFC( C, 9 ) ;
if C > var0 and C[1] < value1 then Buy next bar market;
if C < var0 and C[1] > value1 then sellshort next bar market;
if marketposition = -1 and C > value1 then buytocover next bar market;
if marketposition = 1 and C < value1 then sell next bar market;
setstoploss(50);
setprofittarget(50);
print(datetimetostring(computerdatetime) + " : MarketPosition_at_Broker = " + NumToStr(MarketPosition_at_Broker,0));
print(datetimetostring(computerdatetime) + " : MarketPosition = " + NumToStr(MarketPosition,0));
With MarketPosition_At_Broker always equal to 0 there is no way to write some failsafes that imo are necessary.
Is this is a bug of some sort or is it because of the paper-trading account I am using to test it?.
Can anyone please confirm the correct function of MarketPosition_At_Broker with a real account?