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

Deploying a developed strategy on an account.

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

    Deploying a developed strategy on an account.

    Hi,

    Do you have instructions on how to deploy a strategy (what to change, etc..) to run on your account after you've finished developing it on Playback..?

    If so, please let me know what links / sources you can provide to assist in this endeavor.

    Reason I ask is...

    1. A strategy that runs without errors on Playback mode, where I've been developing it, DOES NOT SEEM TO RUN without errors on live data.

    For example, this statement, which is right out of your NT8 manuals, works ONLY on playback, and gives a "'GetAtmStrategyEntryOrderStatus' method error:" on Real time...

    string[] orderStat=GetAtmStrategyEntryOrderStatus(orderId);

    Fixed version of this that works on Real Time data without this error:

    private string[] orderStat= new string[3];
    orderStat=GetAtmStrategyEntryOrderStatus(orderId);

    So, do you have other surprises like these I should be aware of? Can you point me to where you may have accumulated these critical issues / changes, so that I can skip spending hours and days trying to troubleshoot these. There are obviously others because I'm still not able to get the strategy to execute on Real Time even after getting past this one issue. By the way, as I mentioned, it's working perfectly on PlayBack as-is.

    2. How can I get the strategy to execute on my actual account instead of the SIM account? Where is this parameter that tells the strategy which account to execute on?

    I have enabled the Chart Trader panel on the Chart where I have this strategy applied and activated. Under account I choose the right account I want to execute this strategy on, YET, it's executing on the Sim account and NOT on the account I've chosen. So, how to set it?

    3. Also, the ATMStrategyCancelEntryOrder() call is working on Playback, and works on Simulated Feed, but is not working on Real Time data, in this case on Sim Account. Any suggestions as to why this might be..? <<ATM Strategy function name fixed >>

    Thanks for your support.

    RK
    Last edited by rasdaka; 11-23-2022, 02:45 PM.

    #2
    Hello RK,

    Thank you for your post.
    • What is the full text of the error message you are receiving when using the syntax string[] orderStat=GetAtmStrategyEntryOrderStatus(orderId); in real time?
    I recommend reviewing the reference sample at the following link that demonstrates using this method only if the length of the orderId is greater than zero, and it also checks if the status is filled, cancelled, or rejected and if so it will empty the orderId string:
    https://ninjatrader.com/support/help...atm_strate.htm
    • When running a NinjaScript strategy, the properties window has a dropdown menu where you may select which account you would like the strategy to run on. If you are running a strategy from chart, follow these steps to change the account:
      • Right-click your chart
      • Select Strategies
      • Select either the configured strategy or add a new strategy from the Available list on the left
      • On the right-hand side, locate the Account dropdown menu. Change this from Sim101 to the desired account
        • In order to select a live account, you may need to ensure that Global Simulation Mode is disabled under Control Center > Tools
      • Click OK to save the changes to your strategy
    For more information about available strategy properties, see the help guide page here:
    https://ninjatrader.com/support/help...tegyProperties
    • I am not seeing GetATMStrategyCancelEntryOrder() documented in the help guide nor is it listed in the Intelliprompt list of the NinjaScript Editor. Is it possible you are referring to ATMStrategyCancelEntryOrder()? What is happening when running this on real-time data? You mention it is not working; do you see any error messages in the NinjaScript Output window or the Log tab of the control center?
    Here is the link to the help guide section for ATMStrategyCancelEntryOrder():


    Since this method takes an orderId as an argument, it may be similar to the GetAtmStrategyEntryOrderStatus usage in the reference sample I linked before; you may need to add checks to see that the length of the orderId is greater than zero before trying to access information about an order, as well as adding logic that will empty the orderId string if necessary.

    I understand it can be frustrating when your strategy is not working as expected. It sounds especially frustrating in this scenario because you have tested in Playback and you are getting different results between Playback and Real-Time data. Because ATM strategies only work in real-time and not on historical data, backtesting is not really an option. Testing in Playback may work to test some behaviors, although testing in Simulation in real-time is likely the most ideal testing environment for ATM strategies. If you have not already, I recommend reviewing the information on the following page for some important information about the line between NinjaScript strategies and ATM strategies:


    Please let me know if I may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Hello Emily,

      <Still troubleshooting. This is what I think so far>

      Frankly, what the manual says and what's happening on Sim Real Time do NOT coincide:
      - oddly enough, it's on Playback and Simulation Mode, that the ATM Strategy methods seem to work as they should.
      - on RealTime, there's a lag before the ATMStrategy methods to query the active Strategy order begin to function.
      The picture below is your code - SampleATMStrategy. It points out where there's likely a lag. If allowed for this function to finish executing, the code behaves as it should.
      Curious if the lag is a function of my machine, the latency of the wire connection, or NT8 software. If you have ideas, please let me know.
      Click image for larger version  Name:	image.png Views:	0 Size:	210.9 KB ID:	1224931
      Thanks.

      RK
      Attached Files
      Last edited by rasdaka; 11-23-2022, 07:01 PM.

      Comment


        #4
        Hi,

        Curious how others have been able to code around the lag of the ATM Limit Order that I mention in my previous post. What suggestions has your team given developers in this regard?


        Appreciate the support.

        RK
        Last edited by rasdaka; 11-25-2022, 02:41 AM.

        Comment


          #5
          Hello RK,

          Thank you for your patience.

          When trading on Playback and on a simulation account, the order fills happen locally on your PC and are almost instant. When trading live, orders are submitted to your broker and it can take time for them to be submitted, accepted, and filled. Orders are processed asynchronously on another thread from the strategy and it can take a moment for the order and position updates to come through from your broker. Typically, within the next few bar updates of an order being submitted, then the position and ATM status are updated but this may take a few more bar updates than what is experienced when trading locally on a simulated or Playback101 account. I suspect this is related to the lag that you are reporting and this is expected behavior.

          Please let us know if we may be of further assistance.
          Emily C.NinjaTrader Customer Service

          Comment


            #6
            Hello Emily,
            I'll be looking convert my strategy from using the ATM methods to using normal orders.
            For those looking to do this, do you have any guidance, or can you point to any resources that might speak to this topic?
            Thanks.
            RK

            Comment


              #7
              Hello rasdaka,

              Thank you for your reply.

              If you are looking to develop a strategy that submits its own protective orders rather than using an ATM strategy for stops and targets, I recommend checking out the following reference sample:


              Please feel free to reach out with any additional questions or concerns.
              Emily C.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by llanqui, Today, 03:53 AM
              0 responses
              4 views
              0 likes
              Last Post llanqui
              by llanqui
               
              Started by burtoninlondon, Today, 12:38 AM
              0 responses
              10 views
              0 likes
              Last Post burtoninlondon  
              Started by AaronKoRn, Yesterday, 09:49 PM
              0 responses
              14 views
              0 likes
              Last Post AaronKoRn  
              Started by carnitron, Yesterday, 08:42 PM
              0 responses
              11 views
              0 likes
              Last Post carnitron  
              Started by strategist007, Yesterday, 07:51 PM
              0 responses
              14 views
              0 likes
              Last Post strategist007  
              Working...
              X