Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Why there are two orders filled when I use EnterShortLimit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Why there are two orders filled when I use EnterShortLimit

    HI Ninjatrader Engineers,

    I met an issue when I use EnterShortLimit in script editor. I found when the script is running, there are two orders filled but the quantity I set is 1. I then checked the order lists and log. I found one order is what I expect with "Sell short" action type but the other order's action type is "Sell". I screenshot the log and order lists. Could you please explain this and tell me how to submit 1 order only? Thanks!
    Here is the format I'm using: EnterShortLimit(1, Close[0], @"Long1");


    Click image for larger version  Name:	image.png Views:	0 Size:	12.8 KB ID:	1286619Click image for larger version  Name:	image.png Views:	0 Size:	64.4 KB ID:	1286620​​
    Last edited by AndrewDu; 01-16-2024, 12:09 AM.

    #2
    Hello AndrewDu,

    Thank you for your post.

    Based on your screenshots, you are using NinjaTrader 8. This was initially posted in the NinjaTrader 7 section of the forum; I have moved it to the NinjaTrader Desktop topic, which is relevant for NinjaTrader 8. In the future, please be sure to post your new threads in the most relevant topic. Thank you for your understanding.

    With that said, I see that the order with the 'Sell' action is named "Close position" and the order with the 'Sell short' action is named "Long1." They are both limit orders; one appears to be set up for closing a long position and the other is for opening a short position. I suggest using print statements and enabling TraceOrders in your strategy for more information to help understand and debug your strategy's behavior. For more information on these tools, please see the links below:If you do not understand the output after adding prints and enabling trace orders, please save it by right-clicking the NinjaScript Output window and selecting Save As. Then you will save a text file that can be attached to your response. If you need assistance with creating print statements in your strategy, please share a snippet of your code, such as the conditions that result in the order Long1, and I would be glad to provide you with an example of a print statement you could test out.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DJ888, Today, 10:57 PM
    0 responses
    6 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    158 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Today, 09:29 PM
    0 responses
    7 views
    0 likes
    Last Post Belfortbucks  
    Started by zstheorist, Today, 07:52 PM
    0 responses
    7 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    151 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Working...
    X