Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 11-01-2011, 06:22 PM   #9

Tradewinds's Avatar

Join Date: Nov 2008
Location: Northeast U.S.
Posts: 891
Ignore this user

Thanks: 373
Thanked 231 Times in 164 Posts
Blog Entries: 6

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.
Tradewinds is offline  
Reply With Quote

Reply

Tags
orderstate

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object-Oriented Programming OOP Tradewinds Coding Forum 26 11-06-2011 11:22 AM
EasyLanguage Going Object Oriented ! Tams Tools of the Trade 24 07-03-2010 09:49 AM
Text Object PeterBrazel Coding Forum 0 01-28-2010 09:51 PM
Truncate EL Text Object PeterBrazel Coding Forum 3 08-01-2009 10:38 AM
Stop Order or Logical Order ? abam Trading and the Markets 4 04-06-2009 04:19 AM

All times are GMT -4. The time now is 11:09 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.