Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not working on AWS EC2 instance

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

    Strategy not working on AWS EC2 instance

    I have a strategy that works fine on my local desktop (that I developed it on) for both SIM and Live trading.

    When I put it onto an AWS EC2 instance, everything seems fine:
    1. My custom indicators work
    2. Strategy appears fine and shows as enabled in the strategies tab
    3. No errors in log tab
    4. But it is inactive.
    My strategy draws a TopRight panel to tell me it is running and the parameters used etc. This immediately shows up on price change on my local machine but does not show up on the AWS instance.

    Any help would be most appreciated

    #2
    Hello cnecorp,

    NinjaTrader is not compatible natively on a Macintosh computer and is not officially supported to run with virtualization software or cloud services such as Azure or AWS.
    Our support will not be able to assist with the setup of virtualization software or cloud services.
    As a head up, using any virtualization software
    • Will cause a performance and internet latency impact
    • May cause issues with file paths and access permissions
    Using any cloud services
    • May cause issues with identifying logical processors
    • May cause issues with access permissions
    Further, any operating system issues encountered cannot be supported by our support team.

    A Virtual Private Server (VPS) running a supported version of Microsoft Windows, with a dedicated processor count, would be recommended instead of using cloud services.
    Below is a link to the NinjaTrader Ecosystem website with search results for third-party VPS providers. You can find more information about these companies by visiting their websites and contacting them directly:
    https://ninjatraderecosystem.com/sea...fwp_search=vps


    Regarding the script, importantly, are there errors appearing on the Log tab of the Control Center?

    Try testing the Sample MA Crossover strategy included with NinjaTrader on the same chart or Strategy Analyzer using the same instrument, bar type, interval, and date range.
    Do you see results with the Sample MA Crossover strategy? (This would confirm for us data is available and the issue is with the logic in the custom script)

    If the strategy is getting data and the strategy is enabled or a backtest is run with no errors in the Log tab of the Control Center, and the Sample MA Crossover is returning results, then would likely indicate the logic conditions in the custom strategy did not evaluate as true or orders are being ignored or cancelled.

    In order to better understand how the code is working, it will be necessary to use Print to see how the conditions are evaluating and enable TraceOrders to see if orders are being submitted, ignored, rejected, or cancelled.

    Below is a link to a support article that demonstrates using prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.


    Enable TraceOrders, print the time of the bar and all values used in the conditions that submit entry orders. Include labels for all values and comparison operators.
    Let me know if you need any assistance creating a print or enabling TraceOrders.
    Save the output from the output window to a text file and provide this with your reply.

    I'll be happy to assist with analyzing the output.​
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea.

      I will look into the VPS links that you provided. Will also try the sample MA Cross strategies out of curiosity but suspect will not pursue running strategies on AWS or Azure if not supported.
      Love the thoroughness in your responses as always.


      Ed

      Comment


        #4
        Hello cnecorp,

        For the moment focus on testing the Sample MA Crossover only.

        If the strategy is applied to a chart, is there data with new bars forming on the chart the Strategy is applied to?

        Are the ask and bid prices changing?

        Is the strategy showing as enabled on the Strategies tab of the Control Center? (With the Enabled checkbox checked)

        Do you see the SMA plot lines appearing on the chart when the strategy is enabled?

        Importantly, are there errors appearing on the Log tab of the Control Center?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks Chelsea

          Found the problem. The strategy is coded to begin when CurrentBar > 1000. On the VPS it never got above 325. I do not know why (RAM maybe?). Once I changed it to >250, it worked right away.

          Thanks for your help. Do you know why the CurrentBar never gets above 325?

          Comment


            #6
            Hello cnecorp,

            You may have overwritten the default Sample MA Crossover included with NinjaTrader, as 'CurrentBar > 1000' is in not the original version of this system script. Further, this strategy is locked from editing in the NinjaScript Editor, so the file itself may have been replaced or may have been edited in an external editor.

            I would recommend running the repair from the 8.1.4.1 installer to replace any system indicators and strategies with the original versions.



            CurrentBar is the number of processed bars in OnBarUpdate(). This would also be the number of bars on the chart.
            Use the 'Show Bar Indexes' property of the Data Box window to show the bar number under the mouse pointer.
            Increase the Days to load or Custom Date range to include more days of data to load more bars.

            If the script is encountering a run-time error this could disable the script before more bars can be processed.
            If the script has logic to stop executing code after a condition, this could also cause further bars to stop processing.

            Note, if the bar type is using historical tick data, the NinjaTrader connection type has a limit of 1 year of historical data.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by cnecorp View Post
              Found the problem. The strategy is coded to begin when CurrentBar > 1000. On the VPS it never got above 325. I do not know why (RAM maybe?). Once I changed it to >250, it worked right away.

              Thanks for your help. Do you know why the CurrentBar never gets above 325?
              I assume this code is from your own strategy, not from the sample MA Crossover strategy.

              The answer to your question is:
              It would depend heavily on the instrument, chosen bar type in the chart,
              as well as how many days you've loaded into the chart.

              (Well, maybe not so much on the actual instrument.)

              I betcha the days loaded is different, probably too low on the EW2 instance,
              resulting in not enough bars get created, because not enough days get loaded.

              -=o=-

              Btw, requiring 1000 bars is an awfully high number.

              Just saying ...


              Comment


                #8
                Chelsea Chelsea
                The CurrentBar 1000 was on my custom strategy. But your idea of troubleshooting first with the SampleMA was brilliant. All I needed was to put a debug print into sample MA to prove that the problem was with my code and not some unknown setting somewhere and then use the debugs to vector the issue in the custom code. Thanks

                bltdavid Yeah it was the custom code. It was actually 1440 i.e. number of minutes in a day. I was fully expecting to get errored out with the dreaded out of index range. Early days but it seems to be coping with the small machine. Get 1 year free on the EW2 but think I will stay with the VPS as overall multiuser admin is more familiar. Suspect AWS will be more stable though as I have already had 1 unannounced reboot for updates on the VPS which could prove costly in a live trade, like leaving me in an unmanaged position.
                Last edited by cnecorp; 01-23-2025, 01:41 PM.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Yesterday, 05:17 AM
                0 responses
                66 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                141 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                75 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                46 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