NexusFi: Find Your Edge


Home Menu

 





Problem with Order Overfills with NinjaTrader. What about Multicharts?


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one mattz with 3 posts (0 thanks)
    2. looks_two lawtan with 2 posts (0 thanks)
    3. looks_3 Big Mike with 1 posts (1 thanks)
    4. looks_4 MultiCharts with 1 posts (1 thanks)
    1. trending_up 5,314 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

Problem with Order Overfills with NinjaTrader. What about Multicharts?

  #1 (permalink)
 lawtan 
Singapore
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
Posts: 6 since Apr 2010
Thanks Given: 0
Thanks Received: 0

I have been writing strategies and testing them on NinjaTrader for several months, and once I activate them with live account, I got "order overfill" problem. I implement 1 stop order, and 1 exit order my strategy and do not see anyway to simplify my strategy anymore. I have implemented the Stop order in the OnExecution rountine instead, and still the problem exists. After several correspondances with the Technical Support, there is no clear way to define how it occurs. Most of the time, I do not face this problem in simulation mode, but once the strategy goes live, this problem occurs, and usually it places the order abruptly in the wrong direction, causing me losses in the errorneous trade.
1. I wonder if there is any good way to avoid this problem in NinjaTrader script.
2. Perhaps it is the platform problem. I would also like to explore other more stable and robust trading platforms that I can rely on for live trading e.g, Multicharts recommended by Big Mike. I wonder if this type of "order overfill" problem can be better managed and avoided. Any comments will be appreciated.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
About a successful futures trader who didnt know anythin …
Psychology and Money Management
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,469 since Jun 2009
Thanks Given: 33,246
Thanks Received: 101,669



lawtan View Post
I have been writing strategies and testing them on NinjaTrader for several months, and once I activate them with live account, I got "order overfill" problem. I implement 1 stop order, and 1 exit order my strategy and do not see anyway to simplify my strategy anymore. I have implemented the Stop order in the OnExecution rountine instead, and still the problem exists. After several correspondances with the Technical Support, there is no clear way to define how it occurs. Most of the time, I do not face this problem in simulation mode, but once the strategy goes live, this problem occurs, and usually it places the order abruptly in the wrong direction, causing me losses in the errorneous trade.
1. I wonder if there is any good way to avoid this problem in NinjaTrader script.
2. Perhaps it is the platform problem. I would also like to explore other more stable and robust trading platforms that I can rely on for live trading e.g, Multicharts recommended by Big Mike. I wonder if this type of "order overfill" problem can be better managed and avoided. Any comments will be appreciated.

MultiCharts gives you a lot more control and flexibility than NinjaTrader with automated order execution.

- You can tell it if it should get the quote data from the broker, or from your data feed.
- You can tell it if it should recalculate based on events like order filled or market position change.
- You can tell it to run in sync or async mode, meaning entries/exits are based on what the broker is reporting your position as, or what MultiCharts reports internally.
- Each strategy you run can be told to execute at a different broker, its controllable per-strategy, just like you can control the chart per-datasource.

I suggest you get the trial of MultiCharts and see for yourself. Here is just one excerpt from the on-line help:


Quoting 

Synchronization of the Market Position in the Auto trading Mode

In auto-trading, there are certain circumstances which may cause the actual position and the position shown on the chart to be different. MultiCharts gives the user the ability to set the initial position of the strategy so that the actual position and the position on the chart will be synchronized.
For example, a strategy has long and short orders. The buy order reverses the short position, and the short order reverses the long position. If the position is long 1 contract, then the strategy will sell 2 contracts to reverse the long position. Conversely, if the position is short 1 contract, then the strategy will buy 2 contracts to reverse the short position. The strategy is always either long 1 contract or short 1 contract. The problem arises when this strategy is initially turned on. When this strategy is initially turned on, the actual position is flat. However, the chart will show, for example, that the strategy is already long 1 contract. When the short signal fires, the strategy will think that it already has a long position and therefore short 2 contracts to reverse the long position. This means the actual position is short 2 contracts instead of short 1 contract. Yet the chart shows that the strategy is only short 1 contract, and the actual position should only be short 1 contract.

MultiCharts can prevent such problems from occurring. Before turning on auto-trading, the user can specify the actual position and MultiCharts will understand how to synchronize it with the strategy. In the example above, the user can specify that the actual position is flat. When the short signal fires, MultiCharts will only short 1 contract instead of 2 contracts. The actual position is now synchronized with the chart, and the actual position is correct. Both the actual position and chart position are short 1 contract.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 
mattz's Avatar
 mattz   is a Vendor
 
Posts: 2,493 since Sep 2010
Thanks Given: 2,441
Thanks Received: 3,791

I want to attempt and help you with that.
Can you give a specific example of what the strategy was suppose to do and what it did instead.

Trading futures and options involves substantial risk of loss and is not suitable for all investors. Past performance is not necessarily indicative of future results. You may lose more than your initial investment. All posts are opinions and do not claim to be facts. Please conduct your own due diligence. Use only Risk capital when trading Futures.
1 800 771 6748 local 561 367 8686 email [email protected]
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
 
mattz's Avatar
 mattz   is a Vendor
 
Posts: 2,493 since Sep 2010
Thanks Given: 2,441
Thanks Received: 3,791

From the little research I have done:


If your strategy is working in sim mode, but not in live as expected, you will most likely need to de-bug your strategy order placement method and take an unmanaged order method approach. You can self manage the orders meaning the strategy is not terminated. The Unmanaged approach should only be taken if you are a very experienced programmer based on the risks involved. However, the upside is the Unmanaged approach offers ultimate flexibility in terms of NinjaTrader order submission and management. I would suggest reviewing the NT 7 help guide that covers 'overfills' when taking an Unmanaged approach.


I would suggest also to resend the traces/logs to NT again. If you do, I will give them a push to answer your email.

Let me know if you do.

Trading futures and options involves substantial risk of loss and is not suitable for all investors. Past performance is not necessarily indicative of future results. You may lose more than your initial investment. All posts are opinions and do not claim to be facts. Please conduct your own due diligence. Use only Risk capital when trading Futures.
1 800 771 6748 local 561 367 8686 email [email protected]
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 lawtan 
Singapore
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
Posts: 6 since Apr 2010
Thanks Given: 0
Thanks Received: 0

Thanks Big Mike for your reply. Will try out Multicharts soon.

Mattz, my NinjaTrader strategy has the following functions;
1. Go long upon Long Signal
2. Place Stop Loss order in Iexecution
3. Exit long if Long Signal condition no longer exist or profit target is reached
The opposite is true for Go Short.

The Order Overfill occurs occasionally when a Long ord Short order is placed.

Here is an extract of the code:


Quoting 
protectedoverridevoid Initialize()
{


Add(PeriodType.Tick, tickMT);
Add(PeriodType.Tick, tickLT);
Add(PeriodType.Minute,
13);



EntriesPerDirection =
1;
EntryHandling = EntryHandling.AllEntries;
TimeInForce = Cbi.TimeInForce.Day;

CalculateOnBarClose =
true;
}


privatevoid GoLong()
{ entryOrder = EnterLongLimit(
0, true, orderQty, GetCurrentBid(), "SMTsqt_L"); }


privatevoid CoverLong()
{ exitOrder = ExitLong(
"Exit SMTsqt_L", "SMTsqt_L"); }


privatevoid GoShort()
{ entryOrder = EnterShortLimit(
0, true, orderQty, GetCurrentAsk(), "SMTsqt_S"); }


privatevoid CoverShort()
{ exitOrder = ExitShort(
"Exit SMTsqt_S", "SMTsqt_S");}


protectedoverridevoid OnBarUpdate()
{

if (BarsInProgress == 0)
{ Compute something }


if (BarsInProgress == 1)
{ Compute something and place orders
if (exitOrder == null && Position.MarketPosition == MarketPosition.Long)
{
if xxxx CoverLong() // Profit Target
elseif xxxxCoverLong() // Long Signal no longer exist
}

elseif (exitOrder == null && Position.MarketPosition == MarketPosition.Short)
{
if xxxx
CoverShort() // Profit Target
elseif xxxx CoverShort(); // Short Signal no longer exist
}
elseif (entryOrder == null && Position.MarketPosition == MarketPosition.Flat)
{
if (longcondition) GoLong();
else if (shortcondition) GoShort();

}
}



if (BarsInProgress == 2)
{ Compute something }

protectedoverridevoid OnOrderUpdate(IOrder order)
{
if (entryOrder != null && entryOrder.Token == order.Token)
{ if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
{entryOrder =
null;}
}
}


protectedoverridevoid OnExecution(IExecution execution)
{
if (entryOrder != null && entryOrder.Token == execution.Order.Token)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
if (execution.MarketPosition == MarketPosition.Long)
{
stopOrder = ExitLongStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice - tickStop * TickSize, "Stop SMTsqt_L" , "SMTsqt_L"); }

elseif (execution.MarketPosition == MarketPosition.Short)
{
stopOrder = ExitShortStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice + tickStop * TickSize, "Stop SMTsqt_S" , "SMTsqt_S");

}


if (execution.Order.OrderState != OrderState.PartFilled)
{
if ((stopOrder != null && stopOrder.Token == execution.Order.Token) || (exitOrder != null && exitOrder.Token == execution.Order.Token))
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled)
{
stopOrder = null; exitOrder = null;

}
}



Started this thread Reply With Quote
  #7 (permalink)
 
mattz's Avatar
 mattz   is a Vendor
 
Posts: 2,493 since Sep 2010
Thanks Given: 2,441
Thanks Received: 3,791

I am only assuming, but this could be the case of inflight execution.
Submitting multiple order both long and short very close to the market, then its possible to have the order executed in the reverse side of the market. I have also seen it with programmed OCO orders.

If you PM me I will send you to our programmer who is really good, he could be of help as well.

Trading futures and options involves substantial risk of loss and is not suitable for all investors. Past performance is not necessarily indicative of future results. You may lose more than your initial investment. All posts are opinions and do not claim to be facts. Please conduct your own due diligence. Use only Risk capital when trading Futures.
1 800 771 6748 local 561 367 8686 email [email protected]
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 
MultiCharts's Avatar
 MultiCharts 
Columbus, Ohio, US
 
Experience: Intermediate
Platform: MultiCharts
Broker: Multiple/Multiple
Trading: ES, EUR/USD
Posts: 168 since Oct 2010
Thanks Given: 74
Thanks Received: 172

If you guys have any questions, please send me a PM.

MultiCharts - Raising the Trading Standard.
Please send me a private message if you have any further questions about MultiCharts
Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on October 5, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts