Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Scalp Strategy not submitting stop/target on Rithmic

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

    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:
    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);}
    }
    ​

    #2
    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:If you are not sure what the output of your prints or Trace Orders information means, please feel free to share it with us by right-clicking the NinjaScript Output window and selecting the "Save As" option to save the output to a text file then attach that file to your response.

    Please let us know if we may be of further assistance.

    Comment


      #3
      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


        #4
        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.
        Please follow the steps below to manually attach your log and trace files to your email message (not to a post in the forum) so I may investigate this matter further.
        • 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


          #5
          Click image for larger version

Name:	3BB4237A-F590-4F1A-8E26-5911B70B59B2.jpg
Views:	139
Size:	468.9 KB
ID:	1259385 Todays log, it entered without Target on the second trade while the first was OK, also on another PC whole NT8 crashed when the strat hit the TP
          Attached Files

          Comment


            #6
            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 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.
            Please follow the steps below to manually attach your log and trace files to your email message (not to a post in the forum) so I may investigate this matter further.
            • 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.
            I look forward to assisting you further.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            70 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            143 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            76 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            47 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            51 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X