![]() |
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
|
|||||||
| 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 |
|
|
#1 |
|
Senior Member
Join Date: Jun 2011
Posts: 120
Thanks: 10
Thanked 3 times in 3 posts
|
hello all,
let's say your automated trading strategy creates a juicy trade. you are way up, and you want to take profits, instead of waiting for strategy to exit. what is correct way to exit the trade so that: a) you place a limit order and get that current profitable price? (not a less profitable market price) b) you don't mess up the strategy's "accounting", meaning after you exit, the strategy will show a flat position, not 1L or what have you. thanks in advance. you are generally super helpful. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
Thanks for the note. This depends heavily on the coding of the strategy. Are you using ATM Strategies or EnterLong() calls? Mostly however you will want to cancel the strategy and to do this simply hit the Close button. This will close the strategy, get you out of your position, and cancel any remaining orders left. You can then re-enable your strategy at a later time.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Senior Member
Join Date: Jun 2011
Posts: 120
Thanks: 10
Thanked 3 times in 3 posts
|
Quote:
and for the record, my strategies are coded in terms of EnterLong() calls. Thanks for responding so quickly |
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
In this case I would shutdown the strategy. Strategies Tab->Disable. Then submit your limit order to exit. By disabling the strategy you will ensure that when you exit, your strategy wont then try to exit at a later time (When the strategy was programmed to exit) to submit a order to sell 1 contract (lets say you where long 1 contract before you did the limit order to go flat) then you would end up with an unexpected short position. Let me know if I can be of further assistance.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
You can then re-enable the strategy at a later time and make sure to follow in sync instructions.
Strategy Position vs. Account Position: http://www.ninjatrader-support2.com/...ead.php?t=4033 1st solution: You can include the following statement in your code to avoid the strategy to be calculated on historical data. // Only run on real-time data if (Historical) return; Add the statement to the top of OnBarUpdate() 2nd solution: You can set 'On starting a real-time strategy' to 'Wait until flat before executing live'. This option can be found at Tools-->Options-->Strategies-->NinjaScript-tab. 3rd solution, would be submitting manual orders to sync the strategy and account positions described in the link 4th solution, would be to enable Sync account position to true. http://www.ninjatrader.com/support/h..._positions.htm
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Jun 2011
Posts: 120
Thanks: 10
Thanked 3 times in 3 posts
|
thanks, I'll try this
|
|
|
|
|
|
#7 |
|
Member
Join Date: Sep 2008
Posts: 48
Thanks: 0
Thanked 2 times in 2 posts
|
I've been experimenting using limit orders in my strategies and see that some strategies don't begin to enter trades. Might this be due to a 2 or more tick gap in the bid to ask price? Also, when using market replay, limit orders don't respond properly in strategies. Market orders work fine. I tested grain futures. It appears that using market orders in strategies works best. In these volatile markets, I would prefer to use limit orders in strategies. Any feedback on this subject?
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
Thanks for the note. This is the downside of using limit orders. You will get a good fill but that comes at the price of not getting in the market if the market cannot fill you at that price at that time. Let me know if you feel something else is going on and what information you have that would help us further assist. -Brett
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Jun 2011
Posts: 120
Thanks: 10
Thanked 3 times in 3 posts
|
I totally agree with LTWCI. I'd rather get in on limit orders, knowing full well the order might not be filled. I'm trying to make more successful trades, not necessarily more trades.
I have changed certain strategies to limit orders however, only to find that the strategies never fires. I mean, they totally go "green" and never fire and never turn yellow. They just sit there, like they are broken strategies. |
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Yellow means waiting to go flat to enter live. This means that your strategy has a position in historical that it has no exited. You will need to wait for the exit for the strategy to enable or turn off the option under control center->tools->options->strategies->ninjascript sub tab->uncheck wait for flat before executing live.
Let me know if I can be of further assistance.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Jun 2011
Posts: 120
Thanks: 10
Thanked 3 times in 3 posts
|
Yes, we understand that. What I mean is these suckers just stay green.
Usually, when you enable a strategy over a whole bunch of futures, some of them start off yellow, meaning using historical value, they would have already entered hypothetical trades. but when you enable a strategy with limits orders, it is not uncommon to get all greens, which makes me suspicious |
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
In this case you needed to make sure you are debugging your strategies correctly and checking there status to make sure everything is correctly operating. Please see these guides: http://www.ninjatrader.com/support/f...ead.php?t=3627 http://www.ninjatrader.com/support/f...ead.php?t=3418 Let me know if I can be of further assistance.
Brett
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Automated Limit Order Problem | jul0625 | Automated Trading | 5 | 07-05-2011 11:32 AM |
| Closing ATM or discretionary entries with automated strategies | theKonshus1 | ATM Strategies (Discretionary Trading) | 1 | 05-01-2011 06:44 PM |
| Closing a trade - urgent | tusurtees | Miscellaneous Support | 1 | 02-03-2010 10:32 AM |
| Enter*Limit order + ProfitTarget + reverse position problem | Argo1 | Strategy Development | 9 | 09-08-2009 10:04 AM |
| Automated entry with limit order | John_Aus | SuperDOM and other Order Entry Windows | 5 | 05-12-2008 09:27 AM |