NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 06-20-2012, 07:26 PM   #1
Radical
Senior Member
 
Join Date: Sep 2008
Posts: 543
Thanks: 80
Thanked 187 times in 131 posts
Default Position.Close()

Is the Position.Close() method supported? I only ask because I don't see it in the documentation. If it is supported, does it do what it sounds like and simply close the underlying position? Thanks.

Edit: Also, if it is supported and it does work as I guessed above, will it also cancel any SetStopLoss() or SetProfitTarget() orders that might be attached to it?
Last edited by Radical; 06-20-2012 at 07:38 PM.
Radical is offline  
Reply With Quote
Old 06-21-2012, 02:09 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

Hi Radical, it would unfortunately not be officially supported as NS method - it's calling the Close algorithm you see for example on your DOM and ChartTrader, this should cancel working exit orders, close the position and disable the strategy.
NinjaTrader_Bertrand is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Bertrand for this post:
Old 06-21-2012, 08:40 AM   #3
Radical
Senior Member
 
Join Date: Sep 2008
Posts: 543
Thanks: 80
Thanked 187 times in 131 posts
Default

Thanks Bertrand, I wasn't expecting it to disable the strategy, but that will still be useful. I have another question that's sort of related, so I guess I'll ask it here. If I use "ExitLong()" like this:

ExitLong(1, quantityX, "exit", "entry111");

but the signal name "entry111" doesn't exist, would the above line result in an error, or would it result in nothing happening, and the next line being executed as usual?
Radical is offline  
Reply With Quote
Old 06-21-2012, 09:19 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

If the tagged to entry name would not exist, it should just ignore the command but would not disable your strategy or impact any further following code lines.
NinjaTrader_Bertrand is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Bertrand for this post:
Reply

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
Position does not close Torso Strategy Development 1 10-26-2010 12:56 PM
close position not working werido Miscellaneous Support 2 05-06-2010 11:52 AM
Automatically enter position on Market Open, Close position on Market Close kevendickenson SuperDOM and other Order Entry Windows 1 04-02-2010 04:30 AM
position close on close of bar mballagan Miscellaneous Support 3 01-14-2010 10:11 AM
close position Jesse Automated Trading 1 12-15-2008 10:52 AM


All times are GMT -6. The time now is 05:41 PM.