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 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 itrader46, Today, 10:22 AM
        0 responses
        9 views
        0 likes
        Last Post itrader46  
        Started by NM_eFe, Today, 10:13 AM
        0 responses
        3 views
        0 likes
        Last Post NM_eFe
        by NM_eFe
         
        Started by hdge4u, Yesterday, 12:23 PM
        1 response
        10 views
        0 likes
        Last Post hdge4u
        by hdge4u
         
        Started by 1001111, Today, 09:45 AM
        0 responses
        10 views
        0 likes
        Last Post 1001111
        by 1001111
         
        Started by DTSSTS, 01-28-2024, 12:07 PM
        11 responses
        559 views
        0 likes
        Last Post bmo111
        by bmo111
         
        Working...
        X