Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy turns to yellow

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

    Strategy turns to yellow

    Hi,

    I built an extremely simple strategy that buys at market once enabled.

    OnBarUpdate()

    if(tradeExecuted==false)
    {
    EnterLong();
    tradeExecuted==true;
    Print ("NT executed the trade");
    }

    I supposedly get an execution but that is not reflected on the SuperDOM and the Strategy's name box is Yellow under the Control Center [Strategy] tab. The log doesn't give any error. What could be wrong?

    Thanks in advance.

    - mp

    #2
    Hello marcusplexus,
    The yellow state represents that the strategy is already in a position (in historical bars) and the strategy is waiting to go flat before it could place any live orders.


    Please append the below code so that your strategy do not submits any orders in the historical bars.

    Code:
    protected override void OnBarUpdate()
    {
    
      if (Historical) return;
       //rest of the codes
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      hi I added historical return, now my strategies are not appearing yellow, BUT now backtesting on these strategies is not getting any trades? before I added this function, backtesting was working fine

      Comment


        #4
        Hello calhawk01,

        Thank you for your post.

        Remove the historical check from your code.

        If you want to have your strategy immediately enable in real-time then go to the NinjaTrader Control Center > Tools > Options > Strategies > NinjaScript > and set 'On starting a real-time strategy' to 'Immediately submit live working historical orders'.

        This will set your strategies to immediately submit live working orders rather then waiting for historical trades to close.

        For information on these settings please visit the following link: http://www.ninjatrader.com/support/h...tegies_tab.htm

        Please let me know if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        62 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        32 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        44 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        58 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        47 views
        0 likes
        Last Post CarlTrading  
        Working...
        X