Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A very weird situation with Median[2]

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

    A very weird situation with Median[2]

    Ninjas, this should be very easy to solve for you, this situation is this

    If I add this condition below, it works perfectly:

    if (Close[0]-Median[1]> 0)
    {
    EnterLong();
    }

    But if I add this one, I have non result, zero event, why?

    if (Close[0]-Median[2]> 0)
    {
    EnterLong();
    }

    #2
    pstrusi,

    Could you possible post your code here?

    It could be you are trying to access Median[2] when it doesn't exist yet.

    if ( CurrentBar < 2) return;

    added to the beginning of your OnBarUpdate() may help.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      I'ts no necessary, a very fool error from me...as you well said Median[2] didn't exist cause in Barsrequired I had set 1.

      Thanks my friend

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      637 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      571 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X