Announcement

Collapse
No announcement yet.

Value af second CCI

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

  • Value af second CCI

    I im working on this code display a second CCI value to use as a frontrunner. I have tried different ways to do it, but naw I'm about to give up. Have found an easy way of doing it, it works, but lagging. I also woud like to have the option to change the timeframe for the frontrunner CCI. Coud someone please tell me what I'm doing wrong? The code displays the box on the chart, but text shows NaN, and i also have lagging (colorchange when CCO frontrunner above or below 100/-100.
    Hope someone can help me with this.
    Regards, Finnhan

    EFS attached
    Attached Files

  • #2
    Hello finnhan,

    To add another cci to be plotted by the study you need to add it's series (or return value) to the return statement at the end of main(). Try the following.

    PHP Code:
        return new Array(
            
    vCCI14_of_HLC3.getValue(CCIStudy.CCI),
            
    vCCI14_of_HLC3.getValue(CCIStudy.CCI),
            
    getSeries(xCCI)
        ); 

    The way you have added the formula parameter option to change the time frame for xCCI should work. Give it a try after adding xCCI to your return statement. You aren't seeing any changes occur on the chart because the xCCI study is not currently being plotted.

    Regarding the NaN value, I'm only seeing valid numbers drawn on the chart for both of your labels on a 1-min chart of INTC. Please post a chart image of what you are seeing on your end.

    Regarding the lagging color change, I'm not certain what you mean by this. Please explain in greater detail. Posting some chart images along with your description of the issue will also be helpful.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Thank you

      Thank you very much for your help

      Comment


      • #4
        Value lag

        I mentioned in my last post that i would like to have a value of a second cci on my macci system. I use this value for confirm, or frontrunner. Trading 5 min chart with a 3 min frontrunner plotting on the 5 min chart. Is it a way to get this to update correctly.

        Hope you can help me.


        Comment


        • #5
          Hello finnhan,

          This difference in values is due to the nature of accessing a lower time frame study on a higher time frame chart. The EFS2 synchronization between two intervals is based off of the start times of the bars. I'm assuming that you're using the EFS2 syntax; cci(nNum, inv(3)) in your chart images.

          To illustrate this issue, let's assume we have the following data for the cci() on the following five bars of a 3-min chart.

          Code:
          time:      cci:
          13:00    14.81
          13:03    15.20
          13:06    75.00
          13:09    56.22
          Let's assume that the current time is 13:09:01. At this point in time the 13:05 5-min bar has been created on the 5-min chart and is the current bar index of 0 because this 5-min interval has not yet completed. However, on the 3-min chart the current bar 0 index has a start time of 13:09 and a current cci value of 56.22. In the 13:05 5-min bar the EFS2 engine looks for that bar time stamp on the 3-min chart. If it doesn't find a three minute bar with the same time stamp it goes to the next one it finds after that time stamp. In this case the 3-min bar it finds is time stamped 13:06. However, this bar has completed at 13:08:59 with a closing value of 75.00. Therefore, the 5-min chart displays 75.00 on it's bar 0 while the 3-min chart is displaying it's current 13:09 bar value of 56.22.

          The solution to this dilemma requires two separate formulas. You will create one that runs on the 3-min chart that simply passes the current bar 0 value of the cci() study to setGlobalValue(). Then, in your formula that runs on the 5-minute chart, you will retrieve this value using getGlobalValue() while processing in real time, or bar 0.
          Jason K.
          Project Manager
          eSignal - an Interactive Data company

          EFS KnowledgeBase
          JavaScript for EFS Video Series
          EFS Beginner Tutorial Series
          EFS Glossary
          Custom EFS Development Policy

          New User Orientation

          Comment


          • #6
            Thank you for answer

            If I understand you right, I need to have 2 seperate EFS up at the same time? My idea with this is to only have that 5 min chart up. I have made that frontrunner customizable so you can use the timeframe you want on the frontrunner, displaying it on the top of the panel:
            This is the code i have used:

            --------------------------------------------
            var Symbol = getSymbol();
            if(vInterval==null) Interval = getInterval();
            var Source="hlc3";
            var vSymbol = Symbol+","+cci2interval;
            if(xCCI == null) xCCI = cci(14, eval(Source)(sym(vSymbol)));
            bInit = true;
            ---------------------------------------------
            Regards Finnhan

            Comment


            • #7
              Hello finnhan,

              You're understanding is correct. I understand the idea that you are after, however, as I tried to explain in my previous post, displaying a study value based on a lower time frame interval on a higher time frame chart will not be able to display the most current lower time frame value as you are expecting. The only solution I can think of is the setGlobalValue()/getGlobalValue() method that requires two formulas and two charts.
              Jason K.
              Project Manager
              eSignal - an Interactive Data company

              EFS KnowledgeBase
              JavaScript for EFS Video Series
              EFS Beginner Tutorial Series
              EFS Glossary
              Custom EFS Development Policy

              New User Orientation

              Comment


              • #8
                Thank you Jason

                Thank you very much for your help. Is it possible that it will come a solution for this in the future? Again tnx.

                Comment


                • #9
                  Hello finnhan,

                  You're most welcome.

                  Unfortunately, I don't think there is a solution other than the method I gave you. We're dealing with a logic problem that doesn't have a solution that won't break the current synchronization routines between two different intervals.
                  Jason K.
                  Project Manager
                  eSignal - an Interactive Data company

                  EFS KnowledgeBase
                  JavaScript for EFS Video Series
                  EFS Beginner Tutorial Series
                  EFS Glossary
                  Custom EFS Development Policy

                  New User Orientation

                  Comment

                  Working...
                  X