NinjaTrader Support Forum  

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 06-18-2010, 10:32 AM   #1
jthom
Member
 
Join Date: Jan 2009
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
Default Multi Time Frame Strategy Cancellation

Hello,

I currently have a multitimeframe strategy setup on 4 range and 1 range bars. 4 range handle the entry conditions and initial entry order, while the 1 range series handles order cancellation if the close price moves 2 ticks away from entry order.
The problem im having is that once an order has been placed, a cancellation preceeds it immediately.

PHP Code:
if (Position.MarketPosition == MarketPosition.Flat && BarsInProgress == 0) { 
  if (
Bla Bla) {
     
entryOrder1 EnterLongLimit(0trueDefaultQuantityClose[0] - TickSize"Long 1a");
     
Buy true;}
if (
Position.MarketPosition == MarketPosition.Flat && BarsInProgress == 1) {
   if (
Buy == true && entryOrder1 != null && entryOrder1.LimitPrice != null && Close[0] == entryOrder1.LimitPrice TickSize) { 
   
CancelOrder(entryOrder1);
   
Buy false;} 
The issue seems to be the use of Close[0] in BarsArray = 1. If I use Closes[0][0], it will wait for next 4 range bar to close before cancelling order, which is too far away.
I cannot use Indicator(BarsArray[1])[0] command as the indicator is custom 3rd party.
CalculateonBar close is true.
Any ideas on how to combat this?

Thanks

James

jthom is offline  
Reply With Quote
Old 06-18-2010, 10:42 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

James,

I suggest you actually print what the Close[0] is and what your LimitPrice is being evaluated as. Then compare it to what you see on the chart to see how they can be evaluated together.
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-18-2010, 12:29 PM   #3
jthom
Member
 
Join Date: Jan 2009
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
Default

Hey Josh,

Yeah i have done that. The problem still exists though.
jthom is offline  
Reply With Quote
Old 06-18-2010, 02:18 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

jthom,

Can you please provide me with what kind of print outs you were receiving numerically? Thank you.

Also, please turn on TraceOrders = true so you can see the exact reason an order was cancelled. Thanks.
NinjaTrader_Josh 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
Multi time frame strategy? Hanko Strategy Analyzer 4 11-09-2012 03:34 PM
# of bars are different in multi time frame strategy binwang2 General Programming 3 04-01-2010 07:23 AM
Multi-Instrument Multi-Time frame strategy Shansen Strategy Development 1 12-28-2009 06:09 AM
Multi-time frame strategy laparker Strategy Development 4 05-24-2009 10:03 PM
Multi-time frame strategy - Longer-term real-time calculations Shansen Strategy Development 1 04-19-2009 06:36 AM


All times are GMT -6. The time now is 12:35 AM.