No announcement yet.

Partner 728x90


Strategies mid-run go yellow and stop filling orders sometimes

  • Filter
  • Time
  • Show
Clear All
new posts

    Strategies mid-run go yellow and stop filling orders sometimes

    I've researched this at length here and still can't make sense of what is happening when I go live with strategies that work fine in either live paper or backtesting.

    Today I've got a strategy that appears to be placing live trades - some are "real" and take account positions and closes them out, and others it appears do not become real orders, and the strategy is yellow at that time. It does not take a real account position. It shows it on the live chart as it it's a real order, though other than that the "positions" tab does not show it.

    Is this an order that didn't get filled?
    Holdover from the last order that is causing it to "not be flat?"
    Phantom holdover from missed trade in the opposite direction in the last live trade?

    More strangely, the last time the strategy ghost "yellow" filled, 90% of the way through that trade it actually filled another order, in the opposite direction, which it opened and closed in a matter of minutes at a small profit. And this does not show on the chart at all. I wouldn't have known about it except for seeing it on the trades tab.

    I think I understand the issues of OCO and wait until flat which I had studied when creating the strategies. I do not wish to set the program to go live immediately when turned on for strategic reasons, but that doesn't seem relevant, since this is occurring after a strategy has run for 12+ hours and is actively trading.

    I'm just trying to ensure that the strategies execute the entries they are set for when they don't hold any current position. Their historic past should be clean since they have already exited their last position (which is sometimes a true executed trade). Instead they sometimes fire a ghost order -- or in one case a filled order that doesn't even match what is on my screen.

    This strategy is built with Strategy Builder only. It is set to wait until flat. When I run it paper trading or backtesting there appear to be no similar issues. Please offer any guidance to clear this up. Thank you.
    Last edited by TomTownsend; 08-06-2020, 11:47 AM.

    Hello TomTownsend,

    Welcome to the NinjaTrader forums!

    A strategy that is yellow has calculated a historical position and is waiting to close that virtual position with a real-time virtual order before turning green and trading live. This is the StartBehavior.WaitUntilFlat behavior.

    Once a strategy has turned green, it will not turn back to yellow unless the strategy is disabled and re-enabled and the historical data is re-processed.

    Below is a link to a forum post on start behavior and includes a video that demonstrates.
    Chelsea B.NinjaTrader Customer Service


      Thanks, Chelsea. What you describe is my understanding of how it is supposed to work. I haven't touched this strategy in 12+ hours. It went from green to yellow and placed its first "ghost order" after closing a real order while I was asleep. There's another ghost order running now following the last one - two in a row - so certainly it should be "flat" in between them right? Unless something is "holding over" making it think its not flat? Any advice on this?


        Hello TomTownsend,

        If a strategy was green and became yellow, that strategy had the historical data recalculated.

        Either the strategy was disabled and manually re-enabled, or sufficient re-connection attempts caused the 'On connection loss' > 'Recalculate' setting to recalculate.

        You may be having connection losses.

        If a strategy is not in sync with the account and is using wait until flat, then the account was not flat when the strategy was enabled.

        By 'ghost' order are you referring to the virtual orders for virtual positions?

        The strategy and the account have separate positions. These will be in sync if the account is flat when a strategy with the wait until flat start behavior is enabled.
        Chelsea B.NinjaTrader Customer Service


          Ok, thank you, this helps me focus in on the source of the issue and I think I know why the strategies are going yellow on their own. Despite having upgraded to a high power computer I am still experiencing freezes intermittently that last 3-10 seconds usually, and I think this must be resetting the historical data.

          Things to try that I know from having read the forums in the past are:

          -reduce the number of non-native indicators running, I assume this includes the ones I have downloaded from the NT community pages
          -limit to very few any indicators or strategies calculating on tick
          -keep the overall number of screens running limited in context of the first two

          I've also reset the number of attempts and expanded the time length of connection loss efforts.

          Any other advice I should try to avoid these small freezes?


            Hello TomTownsend,

            Those three items would be good to note. I generally share the following for improving performance.

            Improving performance on the platform

            The impact NinjaTrader has on your PC will be dependent on how much NinjaTrader has to calculate. For example, having several charts with multiple indicators running can cause NinjaTrader to stutter and can cause short freezes. We typically advise the following as tips to improve platform performance.
            1. Configure charts so their Days To Load is an absolute minimum, just enough for your indicators to function properly
            2. Configure indicators to use Calculate.OnBarClose when possible as opposed to Calculate.OnPriceChange and Calculate.OnEachTick.
            3. Use less charts and less complex indicators
            4. Avoid using Tick Replay.
            Various performance tips can be found here —

            You may also wish to use the NinjaScript Utilization Monitor (Control Center > New > Output window > Right click > NinjaScript Utilization Monitor) This tool will tell you which components in your workspace are creating the most impact on your system. This can be a very helpful tool to see what is using the most performance. You can consider that some NinjaScripts like Candlestick ChartStyles will need to draw each bar with each render pass of a chart, so there can be some CPU time spent there that would be expected.

            I also suggest to use the Windows Task Manager to view other programs that are using your CPU, and to close resource intensive programs that are taking juice away that NinjaTrader would otherwise be using.

            Please let us know if we can be of further assistance.
            JimNinjaTrader Customer Service


            Latest Posts


            Topics Statistics Last Post
            Started by Hyper, Yesterday, 09:02 PM
            2 responses
            Last Post Hyper
            by Hyper
            Started by damianfanaro, Today, 06:28 AM
            0 responses
            Last Post damianfanaro  
            Started by Impeesa, Today, 12:53 AM
            1 response
            Last Post NinjaTrader_PaulH  
            Started by artson, Today, 05:40 AM
            1 response
            Last Post NinjaTrader_Jason  
            Started by Impeesa, Today, 03:17 AM
            0 responses
            Last Post Impeesa
            by Impeesa