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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      155 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      307 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      346 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      176 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X