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

Strategy highlighted yellow

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

    Strategy highlighted yellow

    Hi

    When I enable a strategy, sometimes it shows up highlighted in yellow. And it could stay that way for an indefinitely long time. At such times the strategy doesn't seem to be working and the log doesn't show anything. Is there anything I can do to remedy this?

    Options/Strategies/NinjaScript is set at 'Wait until flat before executing live'. Also I set the properties of the strategy at 'Sync account position = False'. Is that the recommended setting?

    Thanks

    #2
    Hello mfouwaaz,

    Thanks for your post.

    When yellow the strategy has taken a historical position with the historical data and is waiting for an exit order or entry in the opposite direction to reverse the position before a live order will be taken.

    This is due to the 'On starting a real-time strategy' option being set to 'Wait until flat before executing live'.

    From the help guide:
    If the Strategy Position is not flat, the strategy will place all trades in a "virtual" sense until the Strategy Position reaches or crosses a flat state. Once a flat state is achieved the Strategy Position will be assumed to be in sync with the Account Position and all future orders will be placed live.

    Below is a link to the help guide on Syncing Account Positions. Please see the section 'Wait until flat before executing live, Sync account position = false'.
    http://www.ninjatrader.com/support/h..._positions.htm

    You can prevent historical trades and the strategy will immediately begin making live trades and will not have any historical trades or historical PnL.

    To do this add

    if (Historical == true)
    {
    return;
    }

    the the beginning of OnBarUpdate() and this will prevent historical trades from processing. Meaning the strategy will be flat when started and ready to make live trades.

    Or you can set the 'On starting a real-time strategy' option to 'Immediately submit live working historical orders'.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Yes -- that did it. Thank you!

      Comment


        #4
        Hello,
        do i understand it correctly that i need to manually add:

        if (Historical == true)
        {
        return;
        }

        to strategy script to make the strategy simply start when I enable it, so it will start green? For example if I have a SMA50 and SMA150 cross as a trade entry point, i want those to be counted on historical data, but i want strategy to ignore any historical, previous trades, when the strategy wasn't enabled yet. I simply want strategy to start green, without any orders at the start.

        Comment


          #5
          Hello,
          The check for historical and then telling it to return would not be counting any of your historical crosses. This check causes not historical processing before the strategy is enabled. You could refer back to data before the strategy was enabled such as if you need the Close of 5 bars ago you would be able to access that but you would not get a count of previous crosses.
          Cody B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          3 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Working...
          X