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!
See more
See less

Partner 728x90

Collapse

Problem with Order Execution

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

    Problem with Order Execution

    Hello,

    there were execution problems in the strategy at a customer whose log entries are unclear.
    The strategy orders with EnterShortStopMarket(1, true, Lots, shortEntryLevel, "SE") and ExitShortStopMarket(1, true, Lots, shortExitLevel, "SX", "SE");
    How to interpret the log when it says :

    07/06/2023 16:01 NinjaScript NinjaScript strategy 'A - 15:30-15:59 70:40:54:75 6 contracts/247348185' sends order.
    and

    07/06/2023 16:01 NinjaScript NinjaScript strategy 'B - NQ Short 4/247348113' sends order.
    Were there two strategies running here?




    Click image for larger version  Name:	problem_orderexecution.png Views:	0 Size:	136.4 KB ID:	1259347

    Thank you.​
    Last edited by signalworks; 07-07-2023, 03:03 AM.

    #2
    Hello signalworks,

    Logs can contain sensitive information, such as account numbers. Moving forward, should have inquiries that are scripting related and the log needs to be provided, please send an email to scriptingsupport [at] ninjatrader [dot] com.

    That said, I am only seeing 1 order submitted in this log from strategy STRAT01 with instance ID 247348185.

    2023-07-06 21:54 Standard strategy 'STRAT01/247348185' submitted an order that generated the following error 'Order rejected'. Strategy sent deletion requests, tried to close the position and ended itself.
    2023-07-06 21:54 Default Disable NinjaScript strategy 'STRAT01/247348185'​

    The error is from the brokerage
    Native error='This account is only allowed to liquidate open positions'

    I would contact the brokerage and inquire why the account is not able to open new positions.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea! I wrote to scriptingsupport.

      One more question about something I noticed in the log file:

      Since the position was closed manually by the client, the account was flat, however, just before the close of the trade, the strategy still ran the logic of the strategy "to close a position at certain time" and wrote an error message to the log.
      The market position of the strategy was obviously not FLAT, because for this logic execution the market position is queried in the code

      How can be taken into account in the code when manual intervention occurs? Strategy position vs account position. I didn't find this scenario in the help, only ones that take effect when a strategy is started.

      Thanks a lot!​
      Last edited by signalworks; 07-10-2023, 12:01 AM.

      Comment


        #4
        Hello signalworks,

        Manual orders do not affect the strategy position or order methods. You would need the strategy to place the order to change the strategies position.
        You could do this through a button click.
        I need some guidance. I need to create a script that has 3 plots that are public and they plot either a 1 or 0. But I need to create another indicator that has 3 chart buttons that sets these variables. The first indicator needs to get those values from the second indicator depending on the button clicks. Because of using
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by JoMoon2024, Today, 06:56 AM
        0 responses
        6 views
        0 likes
        Last Post JoMoon2024  
        Started by Haiasi, 04-25-2024, 06:53 PM
        2 responses
        17 views
        0 likes
        Last Post Massinisa  
        Started by Creamers, Today, 05:32 AM
        0 responses
        5 views
        0 likes
        Last Post Creamers  
        Started by Segwin, 05-07-2018, 02:15 PM
        12 responses
        1,786 views
        0 likes
        Last Post Leafcutter  
        Started by poplagelu, Today, 05:00 AM
        0 responses
        3 views
        0 likes
        Last Post poplagelu  
        Working...
        X