NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

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.

Reply
 
Thread Tools Display Modes
Old 02-13-2012, 02:21 PM   #1
amusche
Junior Member
 
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default EnterLongLimit() and EnterShortLimit place no orders

Hi all,

I just tested this sample script:

protected override void Initialize()
{
CalculateOnBarClose = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Close[0] < Open[0])
{
EnterLongLimit(GetCurrentBid());
}

// Condition set 2
if (Close[0] > Open[0])
{
EnterShortLimit(GetCurrentAsk());
}
}

NinjaTrader places no limit orders. If I use EnterLong() or EnterShort instead this sample script works. I used a ZenFire connection and the Sim101 account to test it. Why are no limit orders placed?

There is no error in the log window and there are also buy and sell signals printed on the chart. Any ideas? Thank you!
amusche is offline  
Reply With Quote
Old 02-13-2012, 02:37 PM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello amusche,
Welcome to the forum and I am happy to assist you.

In the Control Center strategies tab, what is the color of the strategy? If it is yellow then the strategy is waiting until it reaches a flat position http://www.ninjatrader.com/support/h...egies_tab2.htm

To submit the order unlock the strategy (if you are coding via the strategy wizard), and put this code below the OnBarUpdate
Code:
protected override void OnBarUpdate()
{
    if (Historical) return;
    // rest of the code goes below.
Also since you have set CalculateOnBarClose = true, the orders will be placed only on the end of the bar.

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 02-14-2012, 08:17 AM   #3
amusche
Junior Member
 
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi
thank you for your quick answer. That was a good hint. It works now.
amusche is offline  
Reply With Quote
Old 02-14-2012, 08:21 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello amusche,
Glad to know the strategy is working fine.

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 02-14-2012, 08:58 AM   #5
amusche
Junior Member
 
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default

Yes, you can actually. I have some questions concerning the order filling simulation algo used for account Sim101.

How are limit orders assumed to be filled?

Only if there is a tick above the limit (for sell) or below the limit price (for buy)?

What is the impact of adjusting the delay properties (in the Simulator Tab under Options)? I am using a Zen-Fire datafeed on a colocated machine (equinix data center Chicago) to trade the mini S&P 500 future. I have about 1-2 msec delay to the order routing gateway. What is a reasonable value for Delay exchange?

To what degree to you think a series of simulated limit orders is realistic or archeivable in real trading?

That's a lot of questions but the answers would be very helpful for my further development projects. Thank you.
amusche is offline  
Reply With Quote
Old 02-14-2012, 09:50 AM   #6
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello amusche,
In Sim, an buy limit order gets filled when the bid price goes below the buy limit price and in case of a sell limit order gets filled when the ask price goes above the sell limit price.
The simulated orders try to replicate a real time environment. The delay is built in to simulate the lag/latency which we witness in RT while submitting orders.

Please refer to the help files for detals:
Quote:
Delay comm. (msec)* - Simulated delay of sending an order from your PC to a virtual exchange server
Delay exchange (msec)* - Simulated delay of a virtual exchange server processing an order
http://www.ninjatrader.com/support/h...ulator_tab.htm

Its difficult to say on our part to comment anything on the lag part.

In Sim a buy order will get filled only when the bid price goes below buy limit price. In live trading you can get filled/part filled in bid price only. If your strategy is a low latency buy bid/sell ask type then it is difficult to replicate.

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Reply

Tags
enterlonglimit, entershortlimit, limit orders

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EnterLongLimit, EnterShortLimit not works dalisdj Suggestions And Feedback 4 11-06-2011 03:12 PM
EnterLongLimit and EnterShortLimit fail ipso33 Automated Trading 16 08-25-2011 04:43 PM
Can not place ATM on OCO Orders aligator ATM Strategies (Discretionary Trading) 1 12-08-2010 11:46 AM
EnterShortLimit / EnterLongLimit John833 Strategy Development 3 11-20-2008 04:39 PM
Place orders on current price. Czarek Strategy Development 1 11-15-2008 02:24 PM


All times are GMT -6. The time now is 07:11 PM.