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 | ||
---|---|---|---|---|
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
10 responses
1,767 views
0 likes
|
Last Post
by Leafcutter
Today, 03:01 AM
|
||
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
30 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
943 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
||
Started by Max238, Today, 01:28 AM
|
0 responses
9 views
0 likes
|
Last Post
by Max238
Today, 01:28 AM
|
||
Started by rocketman7, Today, 01:00 AM
|
0 responses
7 views
0 likes
|
Last Post
by rocketman7
Today, 01:00 AM
|
Comment