NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM 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 10-04-2008, 09:00 PM   #1
NIKI01
Junior Member
 
Join Date: May 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
Default Multiple Time Bars & Limit Orders

Hi

I am having trouble coding Limit orders with Multiple Time Bars. The orders are generated in the primary bars and immediately cancelled. The TraceOrders log reads as follows:

7/14/2008 9:39:42 AM Entered internal PlaceOrder() method at 7/14/2008 9:39:42 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=25.64 StopPrice=0 SignalName='EST' FromEntrySignal=''

7/14/2008 9:39:42 AM Entered internal PlaceOrder() method at 7/14/2008 9:39:42 AM: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='XLG' FromEntrySignal='ELG'
7/14/2008 9:39:42 AM Ignored PlaceOrder() method: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='XLG' FromEntrySignal='ELG' Reason='This was an exit order but no position exists to exit'

7/14/2008 9:39:42 AM Cancelled expired order: BarsInProgress=1: Order='cf418d4694aa4e4eb4fab02c521d9979/Replay101' Name='EST' State=Working Instrument='MSFT' Action=SellShort Limit price=25.64 Stop price=0 Quantity=100 Strategy='ActVolSlpEMAMUSymbtestSLPBYSELL1T' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='cf418d4694aa4e4eb4fab02c521d9979' Gtd='12/1/2099 12:00:00 AM'

BTW I am using Market Replay to test.

For some reason when using market orders I do get fills, but Limit orders do not seem to work.

Would be grateful for any assistance. I have read the documentation on Multiple Bar Strategies but cannot figure out the problem.

Thanks

NIKI
NIKI01 is offline  
Reply With Quote
Old 10-04-2008, 10:52 PM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Here is what I suggest:
- start with a simple as possible strategy (like the SampleMACrossOver strategy) on replay to see how strategies work on replay. Then add complexity step by step
- please be aware that the sim account will be cleared out as soon as you move the slider on the replay control panel. This will remove any order/position etc.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 10-05-2008, 06:59 PM   #3
NIKI01
Junior Member
 
Join Date: May 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
Default Multiple Time Bars & Limit Orders

Dierk
Thanks for the quick response.

Tried a simple random strategy using EMA. It still appears that limit orders do not work with multiple bars strategies. It could, of course, be my limited coding ability. The primary bars would be anything < 1000 ticks:

protectedoverridevoid Initialize()
{
Add(PeriodType.Tick,
1000);
TraceOrders =
true;
CalculateOnBarClose =
false;
}
protectedoverridevoid OnBarUpdate()
{
if(BarsInProgress !=0)

return;

if (BarsInProgress == 0)
{
if (CrossAbove(EMA(4), EMA(8), 1) && EMA(BarsArray[1], 4)[0]> EMA(BarsArray[1], 8)[0])
{
EnterLongLimit(
100, GetCurrentAsk(0), "ELG");
}
}

The results to the above are that any limit orders generated are immediately cancelled.

Are there any examples of multiple bars strategies using limit orders?

Thanks again

NIKI
NIKI01 is offline  
Reply With Quote
Old 10-06-2008, 07:15 AM   #4
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,


Working orders automatically cancelled if not resubmitted each bar. You will need to build this into your strategy to keep the orders working.

This link may help:
http://www.ninjatrader-support.com/H...verview36.html
NinjaTrader_Ben is offline  
Reply With Quote
Reply

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
Limit Orders Pile Up In Real Time JOHN FORTUNE Automated Trading 5 06-26-2008 03:06 PM
Multiple Limit Orders in a single ATM Strategy Order? Acapulco ATM Strategies (Discretionary Trading) 1 06-19-2008 05:31 AM
How to put a time limit on orders sent from TradeStation to NT joeplaya Automated Trading 7 03-24-2008 11:53 AM
multiple (unwanted) orders fired on 'outside' bars roxana Automated Trading 1 05-25-2007 11:13 AM
Minimum Edition for Entering Multiple Stop-Limit-Orders? WheelsOfSteel Miscellaneous Support 1 01-06-2005 08:06 PM


All times are GMT -6. The time now is 10:39 PM.