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

Strategies mid-run go yellow and stop filling orders sometimes

Collapse
X
 
  • 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.

    #2
    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.
    https://ninjatrader.com/support/foru...541#post811541
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      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?

      Comment


        #4
        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

        Comment


          #5
          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?

          Comment


            #6
            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 — https://ninjatrader.com/support/help...ance_tips2.htm

            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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by itrader46, Today, 09:04 AM
            0 responses
            3 views
            0 likes
            Last Post itrader46  
            Started by timmbbo, Today, 08:59 AM
            0 responses
            1 view
            0 likes
            Last Post timmbbo
            by timmbbo
             
            Started by bmartz, 03-12-2024, 06:12 AM
            5 responses
            33 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by Aviram Y, Today, 05:29 AM
            4 responses
            14 views
            0 likes
            Last Post Aviram Y  
            Started by algospoke, 04-17-2024, 06:40 PM
            3 responses
            28 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X