![]() |
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 |
|
Junior Member
Join Date: Jun 2010
Location: Vancouver, BC
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
|
I am trying to create limit exit orders but they do not show up in a back test when price moves beyond my limit prices. Here's the simple exit code:
if (Position.MarketPosition == MarketPosition.Long) { ExitLongLimit(LXprice, "LX"); } if (Position.MarketPosition == MarketPosition.Short) { ExitShortLimit(SXprice, "SX"); } If the order isn't filled, I'm happy to have the order canceled at the end of each bar and will calculate a new exit point for both long and short entries. Once I get over this hurdle, I'd like to tie these exits to specific entries but the examples are limited on the ExitLongLimit help page. Could you please give me an example of how this is done? ie: Exit a long position, naming the exit so it shows up on the chart and also tying that exit to a specific entry. Also... I'd rather not use SetProfitTarget. When I tried this, only the Long Limit entries worked. Short Limit entries did not show up in a back test. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
Using Print(), I would first check the condition values before the if conditions and use Print("is in conditon 1") etc. to see if it is even entering the condition. If all is well with the above, use Print() again to see if the price you are using is reasonable and signal names match your entry signal names. Thiis link may help: http://www.ninjatrader.com/support/f...ead.php?t=3418
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jun 2010
Location: Vancouver, BC
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
|
Using print and checking the output window, I have confirmed that these exit statements are being hit. I also printed out the prices of the limit orders and checked these prices with the date/timestamps on the chart. Price moves through these points but no exit occurs. In the Exit Limit statements I have tried the following to no avail:
1) putting in the price AND entry name 2) only putting in the exit price (as listed below). if (Position.MarketPosition == MarketPosition.Long) { ExitLongLimit(LXprice); Print(Time[0].ToString() + " LXprice=" + LXprice + " Bar#=" + CurrentBar); } |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
I'm not sure, sorry. Maybe post your log and trace files. Also, you do know what if you are long, and you submit a short order (for example), it will bring you flat. In other words, you don't need to submit an exit. Also, you do know that you have to submit a working order each bar right? Did you cofirm that the order is still working and exists at the time price moves through the order price?
Ben
NinjaTrader Customer Service |
|
|
|
![]() |
| Tags |
| limit exits |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cannot enter a limit price for a limit order on orders tab | cunparis | Version 7 Beta General Questions & Bug Reports | 7 | 07-09-2010 07:01 AM |
| Strategy Limit Order Exits | slimm | Automated Trading | 5 | 02-16-2010 12:47 PM |
| Limit Order Exits not working | daven | Automated Trading | 2 | 08-23-2008 02:17 PM |
| Negative Limit - Stop Limit Entry Orders | biswar | Automated Trading | 1 | 10-18-2005 12:58 AM |
| Exits by Limit in all circumstances | Rognvald | ATM Strategies (Discretionary Trading) | 8 | 02-08-2005 10:41 PM |