Go Back   NinjaTrader Support Forum > NinjaTrader 8 > Strategy Development

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

NinjaTrader
Reply
 
Thread Tools Display Modes
Old 03-01-2017, 09:10 PM   #1
dlespinasse50@gmail.com
Member
 
Join Date: Dec 2016
Posts: 40
Thanks: 1
Thanked 0 times in 0 posts
Default Multi-Instrament Strategy Target & Cancel Orders Cancel Automaticly

I have a multi-Instrument Strategy where I specifiy a generic percent Target and StopLoss. I specify in State== State.Configured. It look like this:

else if (State == State.Configure)
{

SetStopLoss( CalculationMode.Percent, PStopLoss);
SetProfitTarget(CalculationMode.Percent, PTargetProfit);

The Order are all place correctly but after a few minutes I will hear "Order Cancelled". Its the Target and Cancelled orders that automatically cancel for some reason. Would anyone know any reason that would happen. I have set TraceOrders = True but this has not help me find out what is happening.
dlespinasse50@gmail.com is offline  
Reply With Quote
Old 03-02-2017, 07:20 AM   #2
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO
Posts: 10,675
Thanks: 754
Thanked 1,825 times in 1,759 posts
Default

Hello dlespinasse50@gmail.com,

Thank you for your post.

Based on your code and details I would not expect a cancel to occur. Please send me your log and trace files so that I may look into what occurred. You can do this by going to the Control Center-> Help-> Email Support.

Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

I look forward to your response.
NinjaTrader_PatrickH is offline  
Reply With Quote
Old 03-12-2017, 03:25 AM   #3
fpa75
Member
 
Join Date: Sep 2011
Location: Paris (France)
Posts: 68
Thanks: 14
Thanked 3 times in 3 posts
Default

Hello,
I have exactly the same issue with SetProfitTarget in multi instrument strategy. As soon as the entry order is executed, the profit target is sent, but then the order is canceled. The sequence given in the Log tab is always the same : submitted, working, accepted, cancel submitted and finally cancelled.
I have first experienced this on the IB paper trading account, but there is exactly the same behaviour on Playback101.
The code is very basic :

Code:
if (State == State.Configure) {
   AddDataSeries("EURUSD", BarsPeriodType.Minute, 5 );
   SetProfitTarget(SIGNAL_NAME_ENTRY_LONG, CalculationMode.Pips, 5);
}
OnBarUpdate() {
   ...
    EnterLong( 1, FOREX_QUANTITY, SIGNAL_NAME_ENTRY_LONG );
   ...
}
When using "TraceOrders = true" one can see in the log window :
Code:
[...]   Strategy   [...]   Cancelled expired order: BarsInProgress=1, [...]
So it is as if the strategy believes the Profit Target order is expired.

If EnterLong is sent on the main instrument, everything works ok, i.e. the Profit Target order is not cancelled.

I have also tried to check the BarsInProgress in OnBarUpdate to send the EnterLong only when the BarsInProgress is 1, but it changes nothing.

There is probably an issue here.

Thanks.
Last edited by fpa75; 03-12-2017 at 04:42 AM.
fpa75 is offline  
Reply With Quote
Old 03-14-2017, 02:33 PM   #4
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO
Posts: 10,675
Thanks: 754
Thanked 1,825 times in 1,759 posts
Default

Hello fpa75,

Thank you for your post on this matter.

Please send me your log and trace files so that I may look into what occurred. You can do this by going to the Control Center-> Help-> Email Support.

Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

I look forward to your response.
NinjaTrader_PatrickH is offline  
Reply With Quote
Old 03-16-2017, 03:28 AM   #5
fpa75
Member
 
Join Date: Sep 2011
Location: Paris (France)
Posts: 68
Thanks: 14
Thanked 3 times in 3 posts
Default

Hello Patrick,
I have just sent the email with some details.
Best regards,
Fabrice
fpa75 is offline  
Reply With Quote
Old 05-23-2017, 12:33 AM   #6
fpa75
Member
 
Join Date: Sep 2011
Location: Paris (France)
Posts: 68
Thanks: 14
Thanked 3 times in 3 posts
Default

Hello,
After more than 2 months, I still haven't any news from you for this serious issue.
Regards.
fpa75 is offline  
Reply With Quote
Old 05-23-2017, 06:34 AM   #7
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO
Posts: 10,675
Thanks: 754
Thanked 1,825 times in 1,759 posts
Default

Hello fpa75,

Thank you for your update on this matter.

After we received your log and trace files we sent the following response but did not receive a response from your email. We contacted you via platformsupport[at]ninjatrader[dot]com as well as my direct email.
Quote:
Hello,

Thank you for your patience.

Would it be possible to view the full strategy?

Based on your detail and what I see in the Log the order should not be cancelled.

You can export your strategy by going to Tools > Export > NinjaScript Add On > Add > select your strategy > OK > Export > name the file 'NTsupport' > Save.

The file will be located under Documents\NinjaTrader 8\bin\Custom\ExportNinjaScript. Please attach the file to your response.

I look forward to your response.
Sometimes our support emails can get blocked by firewalls/spam filters. If this is the case please unblock NinjaTrader so we may better assist you.
Can I verify, did you receive our previous email or resolve your inquiry?

I look forward to your response.
NinjaTrader_PatrickH is offline  
Reply With Quote
Old 09-11-2017, 08:52 PM   #8
mrlogik
Vendor
 
mrlogik's Avatar
 
Join Date: Sep 2006
Location: New York, USA
Posts: 791
Thanks: 1
Thanked 16 times in 10 posts
Default

Hi NT,

I believe this has to do with the Time In Force setting on the non-native symbols of a multi instrument chart. I am testing and see the same result.

Testing on a 1 minute chart, the target / stop are canceled at the close of the bar. This only occurs on a symbol that is not the chart you apply the strategy to.

Is there a way to set the Time In Force on additional data series when using a multi instrument strategy?
mrlogik
NinjaTrader Ecosystem Vendor - Purelogik Trading
mrlogik is offline  
Reply With Quote
Old 09-12-2017, 09:29 AM   #9
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 856
Thanks: 55
Thanked 208 times in 202 posts
Default

Hello mrlogik,

Thanks for your note.

I believe I am in contact with one of your clients on this matter. I would like to review this matter with an example strategy that demonstrates the issue.

I had asked for the strategy and some steps I can take to reproduce so I can look into the TimeInForce matter and report it further. If you have a simplified strategy that can do this and has some steps I can take, I would greatly appreciate it.

Could I reproduce this in Market Replay or would I need to look at this on a paper trading account?

There isn't an overload for specifying a TIF for an added data series, and it does not look like you can specify a TIF in the Unmanged approach. There is a TimeInForce property that can be set, but I can foresee issues for submitting orders to a different data series when attempting to change this on a BarsInProgress change for example.

I will be happy to assist you further and provide any further input.
Last edited by NinjaTrader_Jim; 09-12-2017 at 10:39 AM.
NinjaTrader_Jim is offline  
Reply With Quote
Old 09-12-2017, 10:47 AM   #10
mrlogik
Vendor
 
mrlogik's Avatar
 
Join Date: Sep 2006
Location: New York, USA
Posts: 791
Thanks: 1
Thanked 16 times in 10 posts
Default

Hi Jim,

Yes, I believe you are.

You can reproduce this using the standard SIM101 account, as well as Replay. I am not using an unmanaged approach; I am simply using EnterLong / EnterShort, and SetProfitTarget / SetStopLoss.

You can use the standard MultiInstrument Strategy sample NT provides for NT8 and see this occur. I have asked my client to send you the code so you can test this on your end.
mrlogik
NinjaTrader Ecosystem Vendor - Purelogik Trading
mrlogik is offline  
Reply With Quote
The following user says thank you to mrlogik for this post:
Old 09-13-2017, 02:36 PM   #11
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 856
Thanks: 55
Thanked 208 times in 202 posts
Default

Hello everyone,

This issue has been designated as a bug and is being tracked with the ticket ID NTEIGHT-12118.

When a fix is implemented in a new build of NinjaTrader, you can reference the ticket ID in the Release Notes page of the Help Guide.

Release Notes - https://ninjatrader.com/support/help...ease_notes.htm
NinjaTrader_Jim 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
Cancel All Orders by strategy soma8 Strategy Development 7 06-01-2016 06:48 PM
Cancel open orders after profit target hit siroki Platform Technical Support 1 10-22-2014 09:02 AM
Stoploss execution does not cancel pending target limit orders cassb Strategy Development 7 05-27-2010 01:01 PM
Strategy: Using CancelOrder() method to cancel orders NinjaTrader_JoshP Reference Samples 0 07-20-2009 01:51 PM
Why does cancel all orders in NT Light cancel real orders in TWS dwight Platform Technical Support 0 11-29-2004 02:54 PM


All times are GMT -6. The time now is 06:03 PM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content.