11-01-2011, 06:22 PM
|
#9 |
Join Date: Nov 2008 Location: Northeast U.S. Thanks: 373
Thanked 231 Times in 164 Posts
| Re: Object-Oriented Order Management Quote:
Originally Posted by Tradewinds » I've had trouble with this line:
QtyOpen = PositionsProvider1.Positi on[0].Quantity; | If the account has no open positions, PositionsProvider1.Positi on[0].Quantity will return an error during trading and shut your indicator down. Which is really stupid, but that's the way it is. But I've found a way to deal with that situation by first checking for any open positions.
If PositionsProvider1.Count <> Null then
Value3 = PositionsProvider1.Positi on[0].Quantity else value3 = 0;
So, if there are no open positions, the code doesn't try to retrieve a quantity. That avoids the error msg, and sets Value3 to 0.
__________________ Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens. |
| |