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!
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
NinjaTrader
Entering Short Trades Bug
Collapse
X
-
Entering Short Trades Bug
Hey guys ive got a bug in my code. It sometimes generates short trades even though there is no line coded "entershort" what might be the cause of this? Is there a way to prevent it entering short trades within a strategy?Tags: None
-
Hi, what do you mean by managed versus unmanaged? I can provide you with some code snippets. I have checked to make sure exit # of shares is not > position.quantity but that does not help.
I am using something like:
if certain conditions are true:
EnterLong(myNumbContracts/2, "Long Side " + tradeNo);
I also have another long entry, with maximum of 2 at one time.
Then I'm scaling out the position
Like ExitLong(numbscaleout);
If a stop is hit, then i just use:
ExitLong();
I have two stopout conditions that both have exitlongs.
Comment
-
Elitetradernyc,
Based off what you are telling me you are using the Managed Approach for the orders.
With the managed approach the only way to have a short position being submitted is to have one of the EnterShort methods being processed.
You can do a search for your code by opening the editor window, Tools -> Edit NinjaScript -> Strategy and press Ctrl + F and type in EnterShort
In order to assist with debugging you would need to send me the script either via Email or attach here in the forum.
Email me at support[at]ninjatrader[dot]com with a reference to this post.Cal H.NinjaTrader Customer Service
Comment
-
Hi sir, as weird as it seems, there is no "Entershort" within the code. I did have one but it was commented and it still enters short trades even without the commented one. Is it possible that my strategy or NT copy is corrupted?
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by traderqz, Today, 12:06 AM
|
10 responses
18 views
0 likes
|
Last Post
by traderqz
Today, 02:49 PM
|
||
Started by algospoke, 04-17-2024, 06:40 PM
|
5 responses
46 views
0 likes
|
Last Post Today, 02:36 PM | ||
Started by arvidvanstaey, Today, 02:19 PM
|
1 response
6 views
0 likes
|
Last Post Today, 02:33 PM | ||
Started by mmckinnm, Today, 01:34 PM
|
3 responses
5 views
0 likes
|
Last Post Today, 02:12 PM | ||
Started by f.saeidi, Today, 01:32 PM
|
2 responses
9 views
0 likes
|
Last Post
by f.saeidi
Today, 02:10 PM
|
Comment