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

Need help with a simple code

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

    Need help with a simple code

    Hi!

    Need some help. The indicator plots nothing and I don't know why. This is the core code. Am I missing something?

    It only calculates a swing in ADX below certain level (bandadx), checking that another ADX is below bandadx1 and finally seeing that +DI and -DI go in different directions.

    Thanks in advance,

    Sergio

    Code:
    protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                if (ADX(14)[2] > ADX(14)[1]
                    && ADX(14)[0] > ADX(14)[1]
                    && ADX(14)[1] < bandadx
                    && ADX(35)[1] < bandadx1
                    && ((DM(14).DiPlus[0] - DM(14).DiPlus[1])* (DM(14).DiMinus[0] - DM(14).DiMinus[1]) < 0.000)
                    )
                {barracuda = 1;}
                else
                {barracuda = 0;}
                Plot0.Set(barracuda);
            }
    Last edited by sercava; 12-05-2011, 08:49 AM.

    #2
    Hello

    Are you receiving any errors on the log tab of the control center?

    You're likely running into an issue explained in the following forum post from our Tips section:



    Please try adding the following snippet to the beginning of your code in OnBarUpdate()

    Code:
    if (CurrentBar < 2)
    return;
    Last edited by NinjaTrader_Matthew; 12-05-2011, 09:07 AM.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Works like a charm now, thanks. Need to put 'CurrentBar' and not 'Current Bar'

      Just beginning with programming with NT and need to make this mistakes. Seems I 'm not the only one. :-)

      Sergio

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,607 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      9 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      19 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      6 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      15 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X