Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator input based on other indicator output

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

    indicator input based on other indicator output

    Hi Ninjas

    In my main indicator conditions I want to include the output of the 2nd indicator. How can I do this?

    Let's say the 2nd indicator is called JonasMACD, its output is 1 or 0 and comes via such code:
    Code:
    if    (blablablaX)    
            
                    {
                    Plot0.Set(1);
                    }
                
    if    (blablablaY)     
                    {
                    Plot0.Set(0);
                    }
    So in my main indicator how exactly should I formulate the condition? (it isn't compiling with code in red)

    if (JonasMACD.Plot0=1)
    {
    Plot0.Set(1);
    }

    if (JonasMACD.Plot0=0)
    {
    Plot0.Set(0);
    }
    Last edited by ionaz; 06-29-2013, 01:57 AM.

    #2
    Originally posted by ionaz View Post
    Hi Ninjas

    In my main indicator conditions I want to include the output of the 2nd indicator. How can I do this?

    Let's say the 2nd indicator is called JonasMACD, its output is 1 or 0 and comes via such code:
    Code:
    if    (blablablaX)    
     
                    {
                    Plot0.Set(1);
                    }
     
    if    (blablablaY)     
                    {
                    Plot0.Set(0);
                    }
    So in my main indicator how exactly should I formulate the condition? (it isn't compiling with code in red)

    if (JonasMACD.Plot0[0]=1)
    {
    Plot0.Set(1);
    }

    if (JonasMACD.Plot0[0]=0)
    {
    Plot0.Set(0);
    }
    You are missing the index, added in blue to your original text.

    Comment


      #3
      Hi Koganam

      Thanks for your post.

      Tried adding the [0] as per your suggestion, but didn't compile either. Also tried with [1], the same.
      The error code CS0119. I attach a screenshot, please have a look.

      Notes:
      JonasMACD = Main indicator (not the 2nd as per previous example), I think it shouldn't make any difference.
      JonasChannel = the 2nd indicator, compiles OK and ends with the following:
      Code:
      if    (blablablaX)[INDENT]{                 
      Plot0.Set(1);                 
      }   
      [/INDENT]if    (blablablaY)[INDENT]{                 
      Plot0.Set(0);                 
      }
      [/INDENT]
      I wonder if I should dim somehow JonasChannel in the JonasMACD code, my main indicator. The only place where I mention JonasChannel is in the condition:
      Code:
      if ([COLOR=red]JonasChannel.Plot0[COLOR=blue][B][0][/B][/COLOR]=1[/COLOR])[INDENT] {
      Plot0.Set(1);
      }
      [/INDENT]
      Attached Files
      Last edited by ionaz; 06-30-2013, 11:24 PM.

      Comment


        #4
        Originally posted by ionaz View Post
        Hi Koganam

        Thanks for your post.

        Tried adding the [0] as per your suggestion, but didn't compile either. Also tried with [1], the same.
        The error code CS0119. I attach a screenshot, please have a look.

        Notes:
        JonasMACD = Main indicator (not the 2nd as per previous example), I think it shouldn't make any difference.
        JonasChannel = the 2nd indicator, compiles OK and ends with the following:
        Code:
        if    (blablablaX)[INDENT]{                 
        Plot0.Set(1);                 
        }   
        [/INDENT]if    (blablablaY)[INDENT]{                 
        Plot0.Set(0);                 
        }
        [/INDENT]
        I wonder if I should dim somehow JonasChannel in the JonasMACD code, my main indicator. The only place where I mention JonasChannel is in the condition:
        Code:
        if ([COLOR=red]JonasChannel.Plot0[COLOR=blue][B][0][/B][/COLOR]=1[/COLOR])[INDENT]{
        Plot0.Set(1);
        }
        [/INDENT]
        Oops. The missing index is what caught my eye, but your if condition is also not a bool, but an assignment. Try:
        Code:
        if ([COLOR=red]JonasChannel.Plot0[COLOR=blue][B][0][/B][/COLOR]=[COLOR=blue][B]=[/B][/COLOR]1[/COLOR])
        See the doubling-up on the equal sign?

        Comment


          #5
          Hi Koganam

          Tried using == as well with everything else suggested so far.
          I get the error (attached).

          Attached Files

          Comment


            #6
            ioanaz, your indicator is a method so you would need to include it's paramters like outlined by Intellisense as well in the call -

            JonasChannel(parameters here).Plot0[0] == 1

            Comment


              #7
              OK!
              I will try this

              Thanks

              Comment


                #8
                Hi

                Checked NinjaScript generated code, but still unsure what to add as indicator's parameters. I have attached this section. Pls help me read (find) the parameters.
                Attached Files

                Comment


                  #9
                  Hello ionaz,

                  Thank you for your response.

                  The Parameters will be seen at the top of the indicator code within the 'Variables' section. Take the EMA for example:
                  Code:
                  	public class EMA : Indicator
                  	{
                  		#region Variables
                  		private int			period		= 14;
                  		#endregion
                  In addition, when typing JonasChannel in your code once you type the first '(' you should see the syntax needed appear.

                  Please let me know if you have any questions.
                  Last edited by NinjaTrader_PatrickH; 07-21-2013, 01:38 PM.

                  Comment


                    #10
                    Thanks

                    I've checked this as per your suggestion and still not clear what indicated how I should reference this indicator correctly. So I attach 2 screenshots:
                    • Variables region from the code - it's actually empty
                    • Pictures of what I see when typing the 1st "(" following the JonasChannel


                    Please advise
                    Attached Files

                    Comment


                      #11
                      Hello Ionaz,

                      Thank you for your response.

                      Can you attach both files (JonasChannel and the indicator or strategy you are calling it in) to your response?

                      If you prefer you can send the files to support[at]ninjatrader[dot]com with 'ATTN: Patrick - 872727' in the subject line.

                      I look forward to assisting you further.

                      Comment


                        #12
                        Hello ionaz,

                        Thank you for your patience.

                        When calling JonasMACD in the JonasChannel you need to use all parameters from the JonasMACD. The parameters you need to define are fast, slow and smooth (see attached screenshot "parametersJMACD.jpg").

                        So the end result would be something like the following:
                        Code:
                        if(JonasMACD(12, 25, 9).Plot111[0] == 1)
                        {
                        //Do Something
                        }
                        Please let me know if I may be of further assistance.
                        Attached Files

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        581 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        338 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        103 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        554 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        552 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X