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

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 traderqz, Today, 12:06 AM
      8 responses
      15 views
      0 likes
      Last Post traderqz  
      Started by SightCareAubetter, Today, 12:50 PM
      0 responses
      1 view
      0 likes
      Last Post SightCareAubetter  
      Started by Mongo, Today, 11:05 AM
      4 responses
      14 views
      0 likes
      Last Post Mongo
      by Mongo
       
      Started by Skifree, Today, 03:41 AM
      5 responses
      13 views
      0 likes
      Last Post Skifree
      by Skifree
       
      Started by traderqz, Yesterday, 09:06 AM
      5 responses
      35 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X