![]() |
|
|||||||
| 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: Jul 2007
Location: Russia
Posts: 7
Thanks: 0
Thanked 0 times in 0 posts
|
I would like to have some insight into the ways Ninja handles Limit orders when a limit order has been sent at a price P and a new Limit order is sent at the same price P (order not amended but a new order).
Does ninja leave the original order in the book queue (as it is the same price) and allocates that order (and therefore keep the position in the queue) to the new limit order generated or does it cancel the order in the queue and send a new order to the exchange (losing the position in the queue)? When setting up in a strategy, CalculateOnBarClose = false in the Initiliaze function to make sure my orders are computed at each tick received (orders computed in context 0, ie BarsInProgress == 0). I update some variables every N ticks, from those variables I generate a Limit orders at every tick. The value of the limit order only changes every N ticks but at every tick I send a new order. Does Ninja is smart enough to recognize that a previous order was positionned in the book at a price P at the previous tick and when a new order is generated at price P at the current tick, leaves the previous order in the queue and does not in fact send a new order to the exchange. Sending a new order would lose the priority in the book ? I read in the documentation somewhere that Ninja should behave that way but I thought I would better ask the question ... Thanks, Fabrice. |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
>> new Limit order is sent at the same price P
Not sure I follow. Are you: a) placing a new order based on different entry signal e.g. EnterLongLimit(price, "newSignal") OR b) are you calling the same entry signal again e.g. EnterLongLimit(price) On a): NT submits a new order On b): NT will not touch the order which is already in the market provided the price did not change
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: Jul 2007
Location: Russia
Posts: 7
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
if (BarsInProgress == 0) { EnterShortLimit(NumContractsToTrade, pEntryShort, "Enter Short"); EnterLongLimit(NumContractsToTrade, pEntryLong, "Enter Long"); } at each tick but the pEntryShort and pEntryLong varies only every N ticks. The "Enter Short" and "Enter Long" never change so I presume I am in case (b) ? So my signal name entry does not change during the N ticks duration period but that order is generated at each tick. I am using a strategy with a target Limit order and I want my target limit order to be sent (exit my position) after N milliseconds if the market has quoted my price but my order was not filled. To be able to timestamp the first quotation at my limit price I need to track all incoming ticks and generate orders at the tick level. I just want to make sure I do not lose my position in the book. I am not sure if there is an automated way to fire Limit orders as market order after a given number of milliseconds if my order was not filled (on a high or low of a bar for example) after the first quotation at my limit order price. Ninja is a good product. I found few bugs here that I will document in the forum. Thanks for your previous answer, Fabrice. |
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Right, scenario (b) -> no issue
Sorry there is no support for a timer driven approach in NT. You would need to handle this by custom coding. Please contact e.g. a NinjaTrader consultant if you would need support on how to do that: http://www.ninjatrader.com/webnew/pa...injaScript.htm
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jul 2007
Location: Russia
Posts: 7
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for your reply, good.
I wrote a strategy with the approach I specified earlier. I have been following Ninja trader since the beginning, great product. I might have found some bugs, will report them to the forum a bit later. Thanks again, Fabrice. |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Jan 2006
Location: Chicago, Illinois, USA
Posts: 126
Thanks: 0
Thanked 1 time in 1 post
|
Hi. Did you ever accomplish turning a limit order to a market order after a certain time period? If so, I would appreciate seeing the code. I would like to do the same thing.
Thanks, Folls |
|
|
|
|
|
#7 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Code:
if (Close[0] > Close[1])
{
if (entryTimeSet == false)
{
enterTime = Time[0];
entryTimeSet = true;
}
if (Time[0] < enterTime.AddMinutes(10) && Position.MarketPosition == MarketPosition.Flat)
EnterLongLimit(100, "Long Limit");
else if (switchedToMarket == false && Position.MarketPosition == MarketPosition.Flat)
{
EnterLong();
switchedToMarket == true;
}
if (Position.MarketPosition == MarketPosition.Long)
{
entryTimeSet = false;
switchedToMarket == false;
}
}
Josh
NinjaTrader Customer Service
Last edited by NinjaTrader_Josh; 10-13-2007 at 03:19 PM.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| entering 2 opposing limit orders | stevenk | Miscellaneous Support | 6 | 04-20-2008 07:45 AM |
| Stop Limit Orders | Quicktrader10 | Miscellaneous Support | 3 | 08-11-2006 07:05 AM |
| Negative Limit - Stop Limit Entry Orders | biswar | Automated Trading | 1 | 10-18-2005 12:58 AM |
| Negative Stop Limit Orders | fred | Miscellaneous Support | 2 | 06-22-2005 03:35 PM |
| Targets - Stop Orders or Stop Limit Orders? | Nereus | ATM Strategies (Discretionary Trading) | 3 | 05-31-2005 07:13 AM |