Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy Submiting 2 Orders at the Same Time, Please Help
Collapse
X
-
Strategy Submiting 2 Orders at the Same Time, Please Help
I m developing a custom strategy, after few months of work, it seems to be done, however, no I m facing this crazy issue: for some reason, sometimes when the strategy close a position due Stoploss (ExitPosition) or TrailStop (ExitStopMarket), strategy execute 2 times de closing command, at the same price and same candle and same time, now this behavior, create a phantom position, in the opposite side of the double closing, The strategy wont show this position in the chart, strategy wont no manage this position, (of course is a phantom position), but I can see the position in the control panel, position. I tried everything and modified my code and stil getting the same issue. Attached charts screen capture and Log an executions list. PLEASE SOME BODY HELP
Tags: None
-
Hello Tonyanse,
This most often occurs when using the managed approach and calling an entry and exit method at the same time, or using multiple exit orders for the same position.
Below is a link to a forum post that discusses.
Enable TraceOrders and print the order.ToString() in OnOrderUpdate() to see which orders are being submitted.
Chelsea B.NinjaTrader Customer Service
-
thanks for your reply, my strategy just handle 1 entry per direction, I got a trailingstop called using ExitShortStopMarket, if the price move in my favor, and I set a ExitPosition, as you can see in the attached chart, the first entries and exits were handled, with no problems with StopExit_ExitName, then suddenly the same process that was working with no problem, created 2 StopExit exits at the same time, sending 2 orders, then the first order effectively close the ShortPosition opened, then the 2nd StopExit, just created a position in the opposite side meaning LONG, now this position is not printed in the chart, the strategy have no knowledge of this position so the strategy can no managed it, then this position keep opened til I closed it manually from control panel. do you think you could double check my script, to help me? maybe you can see in there what i can not. Thanks so much for your reply
Comment
-
Hello Tonyanse,
I'm having trouble following your statement. The output from the prints would be far more helpful.
However, it sounds like you are submitting multiple exits for the same position entry and both exits are filling.
I would suggest you do not submit multiple exits for the same position entry. If necessary to change the order type, cancel the first order, when the order updates as cancelled in OnOrderUpdate() submit the replacement order. This would prevent both orders from being filled.
I would not be able to debug your script on your behalf, but if you want to post this on the forum you can.
To assist I need the print output so I can see what is actually occurring.
Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services or one on one educational support in our NinjaScript Support department. This is so that we can maintain a high level of service for all of our clients as well as our associates.
Through email or on the forum we are happy to answer any specific questions you may have about NinjaScript if you decide to code this yourself. We are also happy to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior.
You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by gustavobp, Yesterday, 05:30 AM
|
2 responses
19 views
0 likes
|
Last Post
![]()
by gustavobp
Today, 07:02 AM
|
||
Started by preqc, 04-10-2022, 01:26 PM
|
2 responses
207 views
0 likes
|
Last Post
![]() |
||
Started by defa0009, 12-13-2024, 09:19 AM
|
23 responses
256 views
1 like
|
Last Post
![]()
by marcus2300
Today, 02:52 AM
|
||
Started by srtrader, 02-12-2025, 09:01 PM
|
3 responses
28 views
0 likes
|
Last Post
![]()
by rockmanx00
Yesterday, 10:21 PM
|
||
Started by bertochi, 02-14-2025, 05:25 PM
|
2 responses
33 views
0 likes
|
Last Post
![]()
by bertochi
Yesterday, 09:35 PM
|
Comment