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

help appreciated

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

    help appreciated

    Hello,

    I am trying to change custom indicator and instead of using normal CCI I am using MA of CCI. I already have indicator modified and is called CCIMA but if I want to make include it into other indicator it shows below listed message. It seems there is missing some argument but "help" is not providing any explanation.

    CCIMA is using period and MA period.

    Is it possible to write how should look correct script sentence?

    Thank you

    Miroslav
    Attached Files

    #2
    Hello Miroslav,

    I am not aware of a CCIMA indicator. Is this one that you have downloaded and imported into NinjaTrader?

    Are you trying to supply the CCI to the SMA indicator?
    For example:
    Print(SMA(CCI(14), 14)[0]);
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Miroslav,

      I am not aware of a CCIMA indicator. Is this one that you have downloaded and imported into NinjaTrader?

      Are you trying to supply the CCI to the SMA indicator?
      For example:
      Print(SMA(CCI(14), 14)[0]);

      Hello,

      thank you it is what I was searching for. I managed to modify indicator and run compile successfully but after loading into chart it is not plotting anything. Any idea where might be the issue?

      I am providing the indicator script.

      Thank you.
      Attached Files

      Comment


        #4
        Hello miroslav,

        I am not able to run this file and test it. This indicator references other indicators that I do not have.

        Regarding this script not plotting on the chart:
        Are you seeing any error messages in the Log tab of the Control Center? If so, what do these say?
        If you add a print to the code where the plots are set, do you see the prints appear in the output window?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello miroslav,

          I am not able to run this file and test it. This indicator references other indicators that I do not have.

          Regarding this script not plotting on the chart:
          Are you seeing any error messages in the Log tab of the Control Center? If so, what do these say?
          If you add a print to the code where the plots are set, do you see the prints appear in the output window?
          Hello Chelsea,

          my apologies I forgot there are some MAs which is not very common. I have modified script to only standard ninja indicators., see attachment. If there is still some issue to run the script please, write me what is missing. There should be no references to other scripts.

          In the log file is written "Failed to call method 'Initialize' for indicator 'ccininja': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart." but it is not the case since I have about 60 days of renko chart loaded.

          After importing script I see only data series but nothing in the indicator, see attached picture.

          thank you for your help.

          Miroslav
          Attached Files

          Comment


            #6
            Hello Miroslav,

            Looking at the code, you have in Initialize():
            switch(mAType1)
            {
            case DMAType.EMA:
            ma1Series.Set(EMA(CCI(FastCCIperiod),mAFast)[0]);
            break;

            You are not going to be able to call an indicator value in Initialize. You have to wait until OnBarUpdate before there will be any historical data to call any indicator.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello Miroslav,

              Looking at the code, you have in Initialize():
              switch(mAType1)
              {
              case DMAType.EMA:
              ma1Series.Set(EMA(CCI(FastCCIperiod),mAFast)[0]);
              break;

              You are not going to be able to call an indicator value in Initialize. You have to wait until OnBarUpdate before there will be any historical data to call any indicator.
              Hello,

              does it mean that there is nothing wrong with script only update is requested? Is there some easy way how to fix it to plot indicator in initialize or how above listed code should be modified?

              Thank you

              Miroslav

              Comment


                #8
                Originally posted by miroslav View Post
                Hello,

                does it mean that there is nothing wrong with script only update is requested? Is there some easy way how to fix it to plot indicator in initialize or how above listed code should be modified?

                Thank you

                Miroslav
                Hello Chelsea,

                I made update of the bars but it is not plotting anything.

                Miroslav

                Comment


                  #9
                  Hello Miroslav,

                  I am only addressing the error that you have posted in Post #5.
                  The error message says that the error was encountered in Initialize().
                  Looking at the code in Initialize() there is invalid code here. Calling an indicator value in Initialize will not work because there is no historical data to be able to supply to the indicator.

                  Have you moved all calls to indicators to a method that is run after the data loads (such as OnBarUpdate)?

                  Where are you setting the plots?
                  Do you have any prints that show that code is being triggered?

                  Are there any more errors appearing in the output window when you run the script?
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by CortexZenUSA, Today, 12:53 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post CortexZenUSA  
                  Started by CortexZenUSA, Today, 12:46 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post CortexZenUSA  
                  Started by usazencortex, Today, 12:43 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post usazencortex  
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  168 responses
                  2,265 views
                  0 likes
                  Last Post sidlercom80  
                  Started by Barry Milan, Yesterday, 10:35 PM
                  3 responses
                  11 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X