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 02-08-2018, 03:03 PM   #16
NinjaTrader_Jesse
NinjaTrader Customer Service
 
NinjaTrader_Jesse's Avatar
 
Join Date: Mar 2014
Location: Denver, CO
Posts: 4,943
Thanks: 30
Thanked 1,263 times in 1,181 posts
Default

Hello dorony,

You have two EnterLong statements in the image you provided, there is one in the Print and one above it. You would need to remove the Print and that should remove the duplicate order.

If you are trying to Print the orders information, you should print before the EnterLong statement with only the information you need but without EnterLong() like the following:
Code:
Print("My Entry Quanity: " + myQuantity);
EnterLong(myQuantity, @"");
I look forward to being of further assistance.
NinjaTrader_Jesse is offline  
Reply With Quote
Old 02-08-2018, 03:10 PM   #17
dorony
Member
 
Join Date: Jan 2018
Posts: 62
Thanks: 11
Thanked 1 time in 1 post
Default

This happened even prior to me adding the print code in there.

if thats the case, then what else could it be?
dorony is offline  
Reply With Quote
Old 02-08-2018, 03:18 PM   #18
NinjaTrader_Jesse
NinjaTrader Customer Service
 
NinjaTrader_Jesse's Avatar
 
Join Date: Mar 2014
Location: Denver, CO
Posts: 4,943
Thanks: 30
Thanked 1,263 times in 1,181 posts
Default

Hello,

I wouldn't be certain without seeing the code you had previously.

If you remove the print and then remove and re-add/re-enable the strategy do you still see the same?

If so, is the entry in the same direction in the same bar? that could be caused by the condition becoming true again if you are using Tick by Tick processing. This would generally require that the position is closed to re-enter unless you have EntriesPerDirection higher than 1.

I look forward to being of further assistance.
NinjaTrader_Jesse is offline  
Reply With Quote
Old 02-08-2018, 03:53 PM   #19
dorony
Member
 
Join Date: Jan 2018
Posts: 62
Thanks: 11
Thanked 1 time in 1 post
Default

Thanks.

I only have it per 1 direction.

Whats funny is that during live it shows multiple orders. However, if I restart it to take the trade in the historical sense, it then turns into 1 trade and with different share amounts.
dorony is offline  
Reply With Quote
Old 02-08-2018, 04:00 PM   #20
NinjaTrader_Jesse
NinjaTrader Customer Service
 
NinjaTrader_Jesse's Avatar
 
Join Date: Mar 2014
Location: Denver, CO
Posts: 4,943
Thanks: 30
Thanked 1,263 times in 1,181 posts
Default

Hello,

Yes, this likely relates to using OnEachTick or that your logic is becoming true again. You can add Prints to the condition to confirm that.

Instead of printing an Entry method, try just printing some debug information like the following and then run it in real-time.
Code:
if(....)
{ 
    EnterLong(...);
    Print("CurrentBar: " + CurrentBar + " Condition true");
}
What is the output you get when the double entry occurs? you should be able to compare this against the historical entry that works to see how the logic was executed. If it was different, you should see a difference in the prints.

I look forward to being of further assistance.
NinjaTrader_Jesse is offline  
Reply With Quote
Old 02-09-2018, 01:32 PM   #21
dorony
Member
 
Join Date: Jan 2018
Posts: 62
Thanks: 11
Thanked 1 time in 1 post
Default

Hey,

Thanks for your help.

Is this normal when you get 2 fills for 1 long order during live triggers?

Also it seems that ninja trader first puts out an order and then a few moments later in time it fills.

Could it be possible that it first calculates when the order is out and then readjusts when it gets filled (that is if the values change for the calculation for share size in between order out and order filled)?
Attached Images
File Type: jpg nt8.JPG (63.8 KB, 4 views)
Last edited by dorony; 02-09-2018 at 01:43 PM.
dorony is offline  
Reply With Quote
Old 02-09-2018, 04:20 PM   #22
NinjaTrader_Jesse
NinjaTrader Customer Service
 
NinjaTrader_Jesse's Avatar
 
Join Date: Mar 2014
Location: Denver, CO
Posts: 4,943
Thanks: 30
Thanked 1,263 times in 1,181 posts
Default

Hello,

Thank you for the reply.

It looks like in the image that is perhaps a partial fill, can you tell me was the quantity for this order 555? You should also be able to review the orders to see if it was partially filled as well.

Regarding fills, can you explain further what you are seeing regarding the script waiting?

I look forward to being of further assistance.
NinjaTrader_Jesse is offline  
Reply With Quote
Old 02-12-2018, 09:15 AM   #23
dorony
Member
 
Join Date: Jan 2018
Posts: 62
Thanks: 11
Thanked 1 time in 1 post
Default

How do I know if it was partially filled?
dorony is offline  
Reply With Quote
Old 02-12-2018, 10:27 AM   #24
NinjaTrader_Jesse
NinjaTrader Customer Service
 
NinjaTrader_Jesse's Avatar
 
Join Date: Mar 2014
Location: Denver, CO
Posts: 4,943
Thanks: 30
Thanked 1,263 times in 1,181 posts
Default

Hello,

You would need to look at what the entry quantity was for your entry and see if that was filled partially.

If your entries per direction is not set to more than 1, and your entry had not been called more than once, it would very likely be a partial fill based on the quantity displayed. If the quantity between the two fills equals what you submitted that would be a partial fill.

You can further confirm this in your code by using OnOrderUpdate or OnExecution and checking the Order's OrderState to see if it was OrderState.PartFilled. You can also compare the Filled amount of the order against the total you had submitted to know if it was partially filled.

Please let me know if I may be of further assistance.
NinjaTrader_Jesse is offline  
Reply With Quote
Old 02-12-2018, 12:36 PM   #25
dorony
Member
 
Join Date: Jan 2018
Posts: 62
Thanks: 11
Thanked 1 time in 1 post
Default

I have my strategy set to only one entry per direction.

Here is an order that just happened. It seems that it is one order getting filled. But would like you to confirm that.
Attached Images
File Type: jpg nt1.JPG (37.4 KB, 1 views)
File Type: jpg NT2.JPG (51.8 KB, 1 views)
File Type: jpg NT3.JPG (85.9 KB, 1 views)
dorony is offline  
Reply With Quote
Old 02-12-2018, 12:51 PM   #26
NinjaTrader_Jesse
NinjaTrader Customer Service
 
NinjaTrader_Jesse's Avatar
 
Join Date: Mar 2014
Location: Denver, CO
Posts: 4,943
Thanks: 30
Thanked 1,263 times in 1,181 posts
Default

Hello,

Yes that looks to potentially be a partial fill based on what you provided but I cannot confirm this for you, this is a step you need to do on your own. I had provided the ways that you can check this in the prior post.

I would suggest using the OnOrderUpdate or OnExecutionUpdate overrides to check what the OrderStatus was for the orders in question. I can only assume that the order was partially filled based on the information you are giving me, you can confirm if this was or was not partially filled by using Prints from OnOrderUpdate or OnExecution.

There is a specific part filled example in the help guide for OnOrderUpdate here: https://ninjatrader.com/support/help...=onorderupdate


Please let me know if I may be of further assistance.
NinjaTrader_Jesse is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Jesse for this post:
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
Custom share service problem Matheusfx Add-On Development 1 08-25-2017 10:39 AM
Custom Share Service sci_fi683 Version 8 Beta 2 09-14-2016 02:50 PM
Custom order size... fxRichard Version 8 Beta 3 07-13-2016 07:09 AM
Basing share size on previous trade result ShruggedAtlas Strategy Development 10 08-13-2015 02:58 PM
EntryLong() / ExitLong() Execution Andi123 Strategy Development 5 11-05-2013 05:47 PM


All times are GMT -6. The time now is 03:55 AM.

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.