Announcement

Collapse
No announcement yet.

CCI value change wrong

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

  • CCI value change wrong

    I've added to my charts the custom CCI indicator with length 14 and source HLC3. I've also added to my cursor window a label displaying the change in CCI value as follows:

    if (vState == BARSTATE_NEWBAR) {
    vCci_last = vCci;
    }
    vCci = cci(14,"HLC3",0);
    CCCI5 = Math.round(vCci - vCci_last);
    .
    retArray[5] = CCCI5;

    This also adds to the cursor window a label displaying the CCI value for the current bar. But the difference between that value and the CCI value displayed for the previous bar is never equal to the difference displayed in my cursor label.

    Here is an example: on the YM #F 5 minute bar chart on Friday 09 February at 15:10 the CCI value displayed is 54.39. On the next bar at 15:15 the value is 59.69, an increase of 5.30. However, the difference displayed in my CCI change label at 15:15 is -33 (minus 33). Similar disparities occur on every bar.

    Can you suggest a correction to my coding or a work-around.

    X

  • #2
    Xenophon
    The syntax used for the cci() function is incorrect and should be
    vCci = cci(14,hlc3(),0);
    For the complete description of the function see this article in the EFS KnowledgeBase
    Once you implement the change you should get the appropriate value (see enclosed image)
    Alex

    Comment

    Working...
    X