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

Indicator of an indicator. What is the right way to do it ?

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

    Indicator of an indicator. What is the right way to do it ?

    I often want to create "indicator in an indicator, in an indicator",
    and I know that I may have to do it with DataSeries.

    But I have not understand which times I CAN use a double,
    and which times I HAVE to only use a dataseries.

    The formula I create other times work, and others not .
    I ask for your help to clear it out, with an example,
    the EMA of ROC of MACD

    For example that works ok...
    mymacd.Set(MACD(12,26,9)[0]);
    double rocmacd=ROC(mymacd, 1)[0];
    Plot0.Set(rocmacd);

    that also....works ok
    mymacd.Set(MACD(12,26,9)[0]);
    rocmacd.Set(ROC(mymacd, 1)[0]);
    Plot0.Set(rocmacd[0]);

    ...but when come to the EMA, ....THIS IS NOT WORKING.
    (it is being compiled and generated normaly
    but the indicator does not plot anything but empty panel.)

    mymacd.Set(MACD(12,26,9)[0]);
    rocmacd.Set(ROC(mymacd, 10)[0]);
    emaroc.Set(EMA(rocmacd, 25)[0]);
    Plot0.Set(emaroc[0]);

    ...and THIS IS NOT WORKING too...
    (it is being compiled and generated normaly
    but the indicator does not plot anything but empty panel.)

    mymacd.Set(MACD(12,26,9)[0]);
    rocmacd.Set(ROC(mymacd, 10)[0]);
    double emaroc=EMA(rocmacd,25)[0];
    Plot0.Set(emaroc);

    *** variables and Initialiaze, include the required lines
    "private DataSeries xxx" and "xxx = new DataSeries (this)"


    So, I try to understand the reason why it is not plotting...

    Can anyone please tell me
    1) Where is the error
    and
    2) If anything is wrong on the logic of using one indicator in an other building DataSeries,
    until you get a final Indicator line in the Plot0...???

    Thanx for all the help.
    Andy.

    #2
    is rocmacd double or dataseries?

    Comment


      #3
      I can not tell.

      Probably (as I mentioned) I have not totaly understand
      the difference between,
      when on calculating an "indicator that uses an indicator"
      we use double, and when we MUST use dataseries.

      That is why I put the 1st sample, with 2 version of Roc of Macd,
      one with double rocmacd, and one with dataseries rocmacd
      that both works ok, until I tried to use an EMA on the rocmacd.


      I think you are telling me that this "rocmacd" must be double...
      Can you explain me the reason why and the core of this error ?

      Thank you.


      P.S. I will send you an e-mail too

      Comment


        #4
        Well ROC of MACD does not make sense, since it's going to be division by zero

        Comment


          #5
          The easiest way...

          Wait for NT7
          (beta is scheduled for Q1 '09.)

          The second easiest way...

          Use the condition builder in the strategy wizard. it allows you to easily use the 'Input Series' parameter of an indicator and choose any other indicator as the input. Then you can view the code and use it to get the syntax.

          Comment


            #6
            Thank you both for the help.

            Comment


              #7
              Hi Andy, when your code does not yield the expected results, your first look should go to the Log tab of the Control Center for any errors. You can also review the level 2 indicator coding tutorial for your project - http://www.ninjatrader-support.com/H...verview18.html
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by jaybedreamin, Today, 05:56 PM
              0 responses
              3 views
              0 likes
              Last Post jaybedreamin  
              Started by DJ888, 04-16-2024, 06:09 PM
              6 responses
              18 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by Jon17, Today, 04:33 PM
              0 responses
              1 view
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              6 views
              0 likes
              Last Post Javierw.ok  
              Started by timmbbo, Today, 08:59 AM
              2 responses
              10 views
              0 likes
              Last Post bltdavid  
              Working...
              X