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 assistance with indicator

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

    Need assistance with indicator

    I am new to Ninja Trader after working with e-signal for several years.

    I need to re-develop my primary indicator. (I'm clueless with Ninja at this point)

    When a bar closes above/below both of 2 EMA's and the shorter is above for a buy and below for a sell.

    When this occurs for the first time after not occurring for at least 3 bars it will mark an arrow on the chart (above price for sell, below price for buy) and give an audible "Buy" or "Sell"

    All assistance will be appreciated

    #2
    Hello chiropharm,

    Welcome to the NinjaTrader Support Forums!

    To start we have a fully documented help guide which will help you get started with Ninja Script. In the help guide you will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.
    http://www.ninjatrader.com/support/h..._resources.htm

    With that said, here is an example of how you can use the EMA to check the Close[] of the current bar.

    Code:
    if(EMA(14)[0] < Close[0] && EMA(15)[0] < Close[0])
    {
          //Do Something
    }
    Here are some helpful references to help you get started that you may want to view.

    EMA: http://www.ninjatrader.com/support/h...onential_e.htm

    Using Brackets []: http://www.ninjatrader.com/support/f...ad.php?t=19346

    Alert: http://www.ninjatrader.com/support/h...html?alert.htm

    To see an example of an Alert() function you can view the code of the PriceAlert Indicators that comes preloaded in NinjaTrader by going to the Control Center -> Tools -> Edit NinjaScript -> Indicator and double click on the PriceAlert.

    Also here is a link to our support forums that goes over how to debug your code which comes in handy if you run into a compiling errors when writing custom code.
    http://www.ninjatrader.com/support/f...ead.php?t=3418


    Let us know if we can be of further assistance.
    Last edited by NinjaTrader_JC; 08-10-2012, 07:57 AM.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thank You.
      This will get me started

      Comment


        #4
        Can you post an example picture of the buy and sell signals? I get a little confused when reading your description, but a picture could help me to understand this.

        Comment


          #5
          I will try and attach a screen shot from Ninja that has been manually annotated
          Attached Files

          Comment


            #6
            Thanks, I've been playing around with this a bit and have it almost done. I'm going to be out for the rest of the weekend so I'll probably finish it next week.

            Comment


              #7
              Here's what I've put together. It's drawing an arrow whenever the price is above the fast EMA and the fast EMA is above the slow EMA as long as there hasn't been an arrow drawn in the last 3 bars. I added in a BarsAgo parameter in case you want to change how many bars back to look for previous arrows.

              I also played around with the idea of only drawing arrows if price crossed above the fast EMA while fast was still above slow or when the fast EMA crossed above slow EMA and price was above the fast. Minor difference, but it did result in fewer arrows. Let me know if you want to see that one.
              Attached Files

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by geddyisodin, Yesterday, 05:20 AM
              8 responses
              51 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              10 responses
              36 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by DayTradingDEMON, Today, 09:28 AM
              4 responses
              24 views
              0 likes
              Last Post DayTradingDEMON  
              Started by George21, Today, 10:07 AM
              1 response
              17 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Started by Stanfillirenfro, Today, 07:23 AM
              9 responses
              25 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X