NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 12-26-2010, 10:33 AM   #1
werido
Senior Member
 
Join Date: Oct 2009
Posts: 157
Thanks: 4
Thanked 0 times in 0 posts
Default Exit orders

Hi,

What is the strategy code that would send out an exit order to close a trade labeled "a" only if that trade is currently open, but would not even try to close out "a" if it is not open?

The strategy that I have now sends out the exit order for "a" whenever the conditions for the exit are met despite the fact that "a" was not even opened to begin with. This doesn't really cause any major problems since NT7 just ignores the exit order if it isn't applicable. But how would I prevent this attempted exit order execution from occurring in the first place?

What I've been using so far is:

if (Position.MarketPosition == MarketPosition.Long)

and this does prevent the exit order from trying to execute when I have no orders open. But this line of code doesn't help when I have order "b" open long, because this line of code just says to send the exit order when there is ANY position open long.

How do I limit it even further so that the condition is that -- only if "a" is long, then and only then send out the exit order: ExitLong("Exit a", "a") ?



Thank you very much.
werido is offline  
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Exit orders syscali General Programming 3 09-20-2010 08:45 AM
ATI Exit Orders for Stop dbvaello Automated Trading 4 06-23-2010 10:19 AM
Modifying Exit Orders heyligerb ATM Strategies (Discretionary Trading) 6 03-17-2010 07:30 AM
Differences in Exit Orders three faced devil Strategy Development 3 10-27-2008 10:41 AM
Exit Via Limit Orders Not Working Xepher Strategy Development 3 04-12-2008 01:59 AM


All times are GMT -6. The time now is 07:32 AM.