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 > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 06-21-2012, 11:42 AM   #1
RodS7
Member
 
Join Date: Mar 2012
Location: DFW, TX
Posts: 40
Thanks: 3
Thanked 7 times in 4 posts
Default Strategy constantly cancelling and replacing order

I have a strategy that enters the market via Limit Order at a moving average.

As the strategy is set to calculate on each tick, it appears the strategy is constantly canceling an order then reentering it - even though the limit price has not changed

Is this normal? Is there a way to stop this from happening?


if (Signal[1] > 0 && Close[0] >= KeltnerEMAChannelTrend(4, 1.5, 21).Midline[0] )
if(Position.MarketPosition == MarketPosition.Flat) // allows only 1 trade per direction
EnterLongLimit(1,KeltnerEMAChannelTrend(4, 1.5, 21).Midline[0], "ZLRe1");
RodS7 is offline  
Reply With Quote
Old 06-21-2012, 11:49 AM   #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 RodS7,
If a limit order is not filled on the bar to which it was submitted then the order is cancelled unless it is explicitly told not to do so. You can tell it by using the below overload and setting the liveUntilCancelled property to true.

Quote:
EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName)
http://www.ninjatrader.com/support/h...rlonglimit.htm

Please modify your code as per below and see if the order remains live or not.
Code:
if (Signal[1] > 0 && Close[0] >= KeltnerEMAChannelTrend(4, 1.5, 21).Midline[0] )
if(Position.MarketPosition == MarketPosition.Flat) // allows only 1 trade per direction
EnterLongLimit(0, true, 1, KeltnerEMAChannelTrend(4, 1.5, 21).Midline[0], "ZLRe1");
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 06-21-2012, 12:27 PM   #3
RodS7
Member
 
Join Date: Mar 2012
Location: DFW, TX
Posts: 40
Thanks: 3
Thanked 7 times in 4 posts
Default

That did it - thanks again

Is there somewhere that lists all functions that I need to address using "barsInProgressIndex" on MTF indicators / strategies?
RodS7 is offline  
Reply With Quote
Old 06-21-2012, 12:35 PM   #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 RodS7,
Glad to know everything is working fine at your end.

To know more about BarsInProgress please refer to our help guide here
http://www.ninjatrader.com/support/h...inprogress.htm

To know more about multi-series, please refer here
http://www.ninjatrader.com/support/h...nstruments.htm

Please let me know if I can assist you any further.
NinjaTrader_Joydeep 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
Strategy with ATM and cancelling non-filled order at bar close Baseheadz Strategy Development 4 08-11-2011 01:37 PM
Order not cancelling kaywai Strategy Development 2 05-08-2011 03:03 AM
Strategy - Limit Order Not Cancelling JayJoshi Strategy Development 7 03-17-2011 05:41 AM
Order Cancelling occam General Programming 5 12-08-2010 08:30 AM
Error canceling and replacing a stop limit order ppperkins Strategy Development 1 01-22-2010 02:43 PM


All times are GMT -6. The time now is 01:37 AM.