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

Charts Freeze with Tick Replay and First Profitable Close

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

    Charts Freeze with Tick Replay and First Profitable Close

    NinjaTrader Support,

    I have developed some strategies that need to run with Tick Replay and are calculated on Price Change. The strategies also exit on the first profitable close.

    However, if I enable these on the chart, the chart freezes. If I edit the strategy to calculate on bar close, everything is fine - however the trade executes a bar late.

    Surely there is a way to visualize strategies that execute on price change on a chart. Is there a setting I am missing?

    #2
    Hello Omermirza,

    Thank you for your post.

    Tick Replay is pretty performance intensive, and calculating On Price Change is going to use more resources than On Bar Close. Does the chart eventually load if you wait long enough? Does reducing the number of days to load on the chart help with the freezing?

    Are any errors regarding the strategy visible in the Log tab of the Control Center when this occurs?

    Does the strategy draw any drawing objects to the chart? If so, does commenting out these affect the freezing issue?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate,

      No, the strategy is not drawing anything and reducing the amount of days does not help. No errors in the Log Tab. I'm wondering, is there a workaround?

      What if I add a 1min data series and send the buy orders to that data series as I can live with the trade being a minute late?

      And then send the Exit to the 4hour data series - do you think that would work?

      Also, would the strategy run fine in the control center even though the chart can't display it?

      Thanks,

      -Omer

      Comment


        #4
        Hello omermirza,

        Thank you for your reply.

        If the freezing is caused by issues with rendering, then it's possible running in the Control Center may help.

        I would suggest turning on TraceOrders and adding some prints to help determine where the strategy may be freezing up before adding additional data series that will also be using Tick Replay.

        The first thing I would recommend would be to turn on the Order Trace function:

        if (State == State.SetDefaults)
        {
        TraceOrders = true;
        }

        Once you then recompile the strategy, you can open a new NinjaScript Output window under New > NinjaScript Output, then apply the strategy. This will print a log of any orders submitted by the strategy during while it's running, along with any ignored orders. You can then look through and see what may be occurring. I'd look for things like large numbers of orders being submitted in a short period on the historical data, as trying to render a large number of order changes in a short time frame is known to cause freezing of charts.

        Here is a link to our help guide that goes into more detail on tracing orders:

        https://ninjatrader.com/support/help...aceorders2.htm

        Trace orders alone may not give you the full picture of whether or not a trade should have been entered on a given bar, so adding prints to your strategy that will show in the NinjaScript Output window can be helpful.

        This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.

        https://ninjatrader.com/support/foru...ns-not-working

        What I'd recommend is putting prints throughout your code to try to determine where exactly the strategy is getting to before it freezes up. I will sometimes put prints between each major chunk of code and narrow down from there.

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

        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Thank you Kate, I'll take a look.

          If you have some time, I'd appreciate it if you could help me over at this thread as I've been stuck for days:

          Hello, I'm trying to implement a StochasticsFast Strategy where I buy when the D value crosses above 20 the second time, without crossing above 80. For example, D value crosses above 20 but stays below 80....then crosses below 20 and I go long once it crosses over 20. I have the code below but it's stuck on


          Thanks,

          -Omer

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Rapine Heihei, 04-23-2024, 07:51 PM
          2 responses
          30 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by Shansen, 08-30-2019, 10:18 PM
          24 responses
          942 views
          0 likes
          Last Post spwizard  
          Started by Max238, Today, 01:28 AM
          0 responses
          9 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by rocketman7, Today, 01:00 AM
          0 responses
          4 views
          0 likes
          Last Post rocketman7  
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          28 views
          0 likes
          Last Post wzgy0920  
          Working...
          X