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