Profile Picture

Trades executing as "time out"

Posted By krschacht 5 Years Ago
Message
Posted Wednesday January 04 2012
I have a system that I'm ready to turn on live. I was testing it one final time with Paper Broker and just today I'm getting this odd behavior where my existing positions are selling automatically. When I say existing positions, I mean that they're coming from LiveOpenPositions.xml.

I've added a bunch of logging to be sure that my code isn't setting a rogue stop order or something like that. All I see in my logs is that it's calling OrderFilled just like a normal trade was submitted. The tradeType == TradeType.ClosePosition.

When I look in the Live panel under the Closed Positions tab and Close Name says "Time out." I checked the Properties panel and Bar Count Exit = 0 and I checked the XML of LiveOpenPositions and they're 0 there as well.

I can't figure out why they're selling?

-Keith
phg
Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)
Posted Wednesday January 04 2012
Let me suggest checking the Simulation Properties panel. My guess is "Bar Count Exit" has been hit. Or possibly "Profit Target". These properties are easy to overlook; nothing shows in the code to remind you they are in play.

-Pete

See also Yahoo group about applying RE.

Posted Wednesday January 04 2012
Hmm, I can't find the Simulation Properties. Do you just mean : View > Properties Window? I did check the properties window and all of those are 0. I'm wondering if they maybe need to be -1 ?

Also, in case it's relevant, this isn't in simulation mode. This is live mode using the Paper Broker.
phg
Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)Supreme Being (44,791 reputation)
Posted Thursday January 05 2012
Sorry about that. View>Properties Window>Position Management>Bar Count Exit. 0 should be fine. I assume this is the IB paper trader?

You may want to show your positions settings code here. However, note that you may want to set 'BarsValid' to -1 although this should not affect anything if you are seeing Order Filled events.

Are these closes occurring immediatley on commencing Live running? RE has a setting to control the disposition of positions held at start up.

Otherwise, I don't know what is happening.

-Pete

See also Yahoo group about applying RE.

Posted Thursday January 05 2012
Hi Keith,

The only time RightEdge would close the position with a message of "Time out" is because of the bar count exit.

When you submit a position, a bar count exit of zero means "no bar count exit". However, this causes the bar count exit on the position that is created to be set to -1. For a position that is already submitted or opened, a bar count exit of zero means that the position will be closed as soon as the next bar finishes.

So if the bar count exit is zero in the LiveOpenPositions XML I would expect the positions to be closed when you ran the system. I don't know how it got set to zero for your open positions- if it was set to zero when you submitted them, I'd expect it to be -1 in the open positions.

Thanks,
Daniel
Posted Thursday January 05 2012
Ah, okay. That helps. What was throwing me was the properties panel showing BarCountExit of 0 but reading the API docs it was implying the value should be -1.

I did manually edit this XML file myself. I'm pretty sure I didn't change the BarCountExit because I tried to only modify the fields that I understood, but maybe I did something in my copy & pasting. I changed that to -1 and that fixed things. Also, I've updated my buy methods to explicitly set -1. I should be all set now.

Thanks!


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems