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

Calling terms from another indicator

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

    Calling terms from another indicator

    I'm trying to set up a sound alert based on certain indicators reaching a predefined level. Those indicators were also programmed in Ninjascript. How can I call on some of those levels in a new indicator (the indicator for sound alert)

    #2
    Some examples:

    if (MACD(12, 26, 9).Avg[0] > someValue)
    if (MACD(12, 26, 9).Diff[0] > someValue)
    if (RSI(20, 3)[0] > someValue)
    if (RSI(20, 3).Avg[0] > someValue)
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thx, but the indicator is not a standard one, it was programmed by someone . . . will the script recognize it anyway or do I have to in some way reference the indicator name?

      Comment


        #4
        You will have to reference the indicator name and then the plot name. Unfortunately I cannot assist you much since I do not know how your indicator was programmed. You may want to ask the author directly.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Unfortunately, I don't know who the author is . . . it was a post on a forum. But maybe you can help. I can't post the whole code here (it's pretty long) but see below for the relevant sections.

          I want an sound alert when both conditions are met in either of the following 2 situations:

          Situation 1
          trendingHist < -10
          primeLow [1] > primeLow [0]

          Situation 2
          trendingHist > 10
          primeHigh [1] < primeLow [0]

          The indicator is named gpLogicPrimes

          This is in the variables section:
          privatedouble[] primeHigh; //Array for prime highs
          privatedouble[] primeLow; //Aray for prime lows

          DataSeries trendingHist; //Trending Histogram

          This is in the onbarupdate section:

          //Calculate Trending Histogram
          trendingHist.Set((trendingERG[0] - trendingERG[1]) * 75);

          . . . .

          //Display price at each extreme support peak, update list with new extreme price value
          if (eRGTradingSupport)
          {
          if (LowestBar(Low, CurrentBar - supportOscTradeBar) == 0 )
          {

          primeLow[1] = Low[0];

          if (primeLow[1] > primeLow[0])
          { . . . .

          Comment


            #6
            Insearch,

            Unfortunately I cannot be of much assistance. For 3rd party indicator support you will have to inquiry the original author.

            As a guess you can try something along the lines of this in a separate indicator:
            Code:
            if (gpLogicPrimes().trendingHist[0] < -10 && gpLogicPrimes().primeHigh[1] > gpLogicPrimes().primeLow[0])
                 // Do something;
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thx, I'll try that . . . what I really needed was the syntax . . .

              Will I have to input anything in the variables section or initialize section of the "new" code?

              Comment


                #8
                Like I mentioned earlier Insearch, there is not much I can do to assist you, especially for syntax. I have no idea how the 3rd party indicator was created and as such you have to talk to the original author. There is nothing more I can do.

                You generally do not need to do things in Initialize or Variables.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by RookieTrader, Today, 09:37 AM
                3 responses
                14 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by kulwinder73, Today, 10:31 AM
                0 responses
                5 views
                0 likes
                Last Post kulwinder73  
                Started by terofs, Yesterday, 04:18 PM
                1 response
                23 views
                0 likes
                Last Post terofs
                by terofs
                 
                Started by CommonWhale, Today, 09:55 AM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by Gerik, Today, 09:40 AM
                2 responses
                7 views
                0 likes
                Last Post Gerik
                by Gerik
                 
                Working...
                X