protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)
{
if (order.Name == "Target"){
if (order.OrderState == OrderState.Rejected && rejected<5)
{
if (entryOrder.IsLong)
try{
targetOrder = ExitLongLimit(2, true, entryOrder.Filled, entryOrder.AverageFillPrice + tp, "Target", "Long");
}
catch
{
Print("Error 1");
}
if (entryOrder.IsShort)
try{
targetOrder = ExitShortLimit(2, true, entryOrder.Filled, entryOrder.AverageFillPrice - tp, "Target", "Short") }
catch
{
Print("Error 2");
}
rejected++;
Print("Target Rejected: "+rejected);
}
else if (order.OrderState == OrderState.Filled)
rejected=0;
else if (order.OrderState == OrderState.PartFilled && rejected<5)
{
try{
ChangeOrder(targetOrder,entryOrder.Filled,0,0);
}
catch
{
Print("Error 3");
}
rejected++;
Print("Target PartFilled: "+rejected);}
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Scalp Strategy not submitting stop/target on Rithmic
Collapse
X
-
Scalp Strategy not submitting stop/target on Rithmic
Hi Ninjatrader community, i hope some of you coders can help me fix this issue with rithmic order submission, i have a scalping strategy and most of the time the order gets filled (like 3 contracts on NQ) but the target and stoploss does not, or it gets partially filled, most of the time there is NO stop and NO target or the target is 2 contracts out of 3 and leaves the trade open, i need to fix this issue, i thought about trina to send another order or change the current target contracts if the order was rejected or part filled like this:
Code: -
Hello Pole123,
Thank you for your post.
Of course this thread will remain open for the community to chime in and assist you with your strategy. It is worth noting that adding print statements to your strategy as well as enabling Trace Orders can help you to understand your strategy's behavior and break down why an order was or was not submitted as expected. For more information and tips on adding prints to debug your scripts as well as how Trace Orders works, please see the following links:- https://ninjatrader.com/support/foru...ing#post791121
- https://ninjatrader.com/support/help...aceorders2.htm
Please let us know if we may be of further assistance.
-
Hi thanks, i don’t have any logs yet, but what i mostly see it an error message popping on the screen with the error and order rejection, note: Target and Stop are points away from the enter price so there should not be problems with price being above / below market price
Comment
-
Hello Pole123,
Thank you for your reply.
I would like to take a look at these errors in your diagnostic files via email. Please send an email to support[AT]ninjatrader[DOT]com. Include "ATTN Emily C" in the subject line and please answer all of the following questions:- What is the name of your strategy?
- What Order ID was assigned to one of the orders that resulted in the errors? You can check in the Executions or Orders tab of the Control Center.
- Do you receive an error on the screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?
- To send a screenshot with Windows 10 or newer I would recommend using the Windows Snipping Tool.
- Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save it as a jpeg file and send the file as an attachment.
- Open your NinjaTrader folder under My Documents.
- Right-click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
- Send the 2 compressed folders as attachments to this email.
- Once complete, you can delete these compressed folders.
Thanks in advance; I look forward to assisting you further.
Comment
-
Hello Pole123,
Thank you for your reply.
I appreciate the screenshot, though I will need the previously requested information to be sent to me via email in order to accurately assist you. Please follow the steps mentioned in my reply:
I look forward to assisting you further.I would like to take a look at these errors in your diagnostic files via email. Please send an email to support[AT]ninjatrader[DOT]com. Include "ATTN Emily C" in the subject line and please answer all of the following questions:- What is the name of your strategy?
- What Order ID was assigned to one of the orders that resulted in the errors? You can check in the Executions or Orders tab of the Control Center.
- Do you receive an error on the screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?
- To send a screenshot with Windows 10 or newer I would recommend using the Windows Snipping Tool.
- Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save it as a jpeg file and send the file as an attachment.
- Open your NinjaTrader folder under My Documents.
- Right-click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
- Send the 2 compressed folders as attachments to this email.
- Once complete, you can delete these compressed folders.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
70 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
143 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
76 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
47 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
51 views
0 likes
|
Last Post
|

Comment