![]() |
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: Dec 2008
Posts: 198
Thanks: 0
Thanked 0 times in 0 posts
|
I'm having some issues with Limit Orders where they keep changing as the market keeps moving... I have it set that its liveUntilCancelled, but still seem to be having issues...
SHORTS.... Code:
if (some condition is met)
{
EnterShortLimit(0, true, DefaultQuantity, GetCurrentAsk() + 2 * TickSize, "ShortA");
EnterShortLimit(0, true, DefaultQuantity, GetCurrentAsk() + 3 * TickSize, "ShortB");
EnterShortLimit(0, true, DefaultQuantity, GetCurrentAsk() + 4 * TickSize, "ShortC");
}
Code:
if (some condition is met
{
EnterLongLimit(0, true, DefaultQuantity, GetCurrentBid() - 2 * TickSize, "LongA");
EnterLongLimit(0, true, DefaultQuantity, GetCurrentBid() - 3 * TickSize, "LongB");
EnterLongLimit(0, true, DefaultQuantity, GetCurrentBid() - 4 * TickSize, "LongC");
}
|
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
If you keep submitting the orders over and over they will keep amending and moving. Don't resubmit if you don't wish to amend the order.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2008
Posts: 198
Thanks: 0
Thanked 0 times in 0 posts
|
so how would I ammend this if I don't keep order submission in OnBarUpdate()?
Last edited by BigDog008; 06-04-2009 at 11:44 AM.
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Not sure I follow. Your original post eluded to you not wanting the orders to move. If you don't want them to move, do not resubmit your orders. If you want to amend them then simply call the EnterShortLimit() again.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Senior Member
Join Date: Dec 2008
Posts: 198
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
I currently have the EnterShortLimit and EnterLongLimit in the OnBarUpdate() section because I want to be able enter them based on current market prices... |
|
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
You can use flag variables.
Code:
if (flag == false)
{
EnterLongLimit(...);
flag = true;
}
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Limit orders not being executed at limit | Marzullo | Miscellaneous Support | 15 | 08-24-2011 01:20 PM |
| SIM Limit orders executing as market orders | ericadam | SuperDOM and other Order Entry Windows | 11 | 10-10-2010 11:42 AM |
| issues with stop limit orders | woodside | General Programming | 4 | 02-12-2008 09:45 AM |
| Limit orders - book position kept when new orders are generated | Fabrice | Automated Trading | 6 | 10-13-2007 03:16 PM |
| Negative Limit - Stop Limit Entry Orders | biswar | Automated Trading | 1 | 10-18-2005 12:58 AM |