NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > ATM Strategies (Discretionary Trading)

ATM Strategies (Discretionary Trading) Support for Advanced Trade Management, AutoTrail, AutoBreakeven, Stop Strategy and Simulated Stops etc...

Reply
 
Thread Tools Display Modes
Old 03-11-2010, 06:56 AM   #1
jthom
Member
 
Join Date: Jan 2009
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
Default Using CancelOrder with SampleATMStrategy

Just needing a slight bit of help in creating a cancellation of the current order if the price moves 4 ticks away before being filled using the SampleATMStrategy.
Here is some of the Code. Any help would be greatly appreciated.
if (
orderId.Length ==
0
&& atmStrategyId.Length ==
0
Blah Blah

)
{
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(Cbi.Action.Buy, OrderType.Limit, Close[
0] -1 * TickSize, 0, TimeInForce.Day, orderId, "Blah", atmStrategyId);
}
elseif (
orderId !=
null
&& Close[
0] == orderId.LimitPrice + 4 * TickSize)
{
CancelOrder(orderId);
}

if (

orderId.Length ==
0
&& atmStrategyId.Length ==
0
blah blah
)
{
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(Cbi.Action.Sell, OrderType.Limit, Close[
0] -1 * TickSize, 0, TimeInForce.Day, orderId, "blah", atmStrategyId);
}
elseif (
orderId !=
null
&& Close[
0] == orderId.LimitPrice - 4 * TickSize)
{
CancelOrder(orderId);
}

jthom is offline  
Reply With Quote
Old 03-11-2010, 08:32 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

CancelOrder is for NinjaScript orders only, not ATM orders. If you want to cancel an ATM order you need to use this: http://www.ninjatrader-support.com/H...StrategyActive
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
CancelOrder() problem boreland Strategy Development 1 12-28-2009 05:33 AM
SampleATMStrategy and AtmStrategyChangeStopTarget MXASJ Strategy Development 1 07-30-2009 06:12 AM
How CancelOrder() work? xewoox Strategy Development 6 02-18-2009 02:21 PM
Simple Limit Strategy with CancelOrder stefy Strategy Development 7 11-10-2008 07:44 AM
CancelOrder() problem John833 Strategy Development 41 10-31-2008 03:15 PM


All times are GMT -6. The time now is 04:38 AM.