![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Sep 2008
Posts: 543
Thanks: 80
Thanked 187 times in 131 posts
|
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.
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
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.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Bertrand for this post: |
|
|
|
#3 |
|
Senior Member
Join Date: Sep 2008
Posts: 543
Thanks: 80
Thanked 187 times in 131 posts
|
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? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
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.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Bertrand for this post: |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |