Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy will not enable, always yellow

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

    Strategy will not enable, always yellow

    using winXP and NT 7.0.0.21 (Multi)


    Hi, I tested trading strategys with simulation accounts (two very simple strategys):

    First only long trades, second only short trades (sample SHORT)

    protected override void OnBarUpdate()
    {
    // Condition set 1 EXIT SHORT
    if (CrossAbove(SMA(Fast), SMA(Slow), 1))
    {
    if (Position.MarketPosition != MarketPosition.Flat)
    {
    ExitLong("30secL_Exit", "");
    }
    }

    // Condition set 2 SHORT
    if (CrossBelow(SMA(Fast), SMA(Slow), 1))
    {
    EnterShort(1000, "30secS_Start");
    }
    }

    If I enable the strategys (tab -> strategy) with a simulation account (each with a separate account) I can see the cell in yellow status.

    But never (no matter how often crosses the ema) the strategy is green and never work.

    I use two accounts (Sim103S=Short trades and Sim103L=Long trades).First of all I killed the old history of the sim accounts via tools->options->simulator->reset an tryed a restart.

    But after that it is the same problem, cell is yellow, strategy is not working. (I use wait until flat bevor executing live).

    Torso


    Torso

    #2
    Torso,

    This is because your code is inaccurate in your exit conditions. When you are in a short position you will need to use ExitShort() not ExitLong() to close that position. Using ExitLong() when in a short position would just be ignored and no exits would ever be placed which is why your strategy is always in a Yellow state.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks,

      it was easy, now it works

      Comment

      Latest Posts

      Collapse

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