CCI indicator readings off

Created at 26 Aug 2017, 04:37
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
BD

bdfx

Joined 22.09.2016

CCI indicator readings off
26 Aug 2017, 04:37


I was working on a robot using the CCI stock indicator in cAlgo and noticed a difference between the CCI index reading with the Market Snapshot Tool and the value printed in the Log for the same bar at 19:00 Aug 24, 2017 EURUSD. I then looked at the same bar in Web CTrader and the CCI value. Both indicators in cAlgo and the WebTrader version were using Period 20 (no shift). The robot was responding according to the values printed in the Log and not the readings with the screen tools.

cAlgo Log value    cci:  -123.73064808459

cAlgo Market Snapshot Tool:    Commodity Channel Index  -90

cTrader Web version Market Snapshot Tool:  -69.60814

Code snippet for the cci value:

  private void ManageTrend()
        {

            var ehmaCurrent = _ehma.Result.Last(0);
            var ehmaPrevious = _ehma.Result.Last(3);
            var cciCurrent = _cci.Result.LastValue;



            var ehmaDifference = ehmaCurrent - ehmaPrevious;

            if (cciCurrent > 100 && _cci.Result.IsRising() && ehmaDifference > 0)
            {
                trend = "up";
            }

            else if (cciCurrent < -100 && _cci.Result.IsFalling() && ehmaDifference < 0)
            {
                trend = "down";
            }

            else
            {
                trend = "neutral";
            }

            Print("trend: {0} ; cci: {1};  cci direction: {2};  ehmaDiff: {3}", trend, cciCurrent, _cci.Result.IsRising(), ehmaDifference);
        }

 

SpotWare, Any ideas on why this is happening?

 

 


@bdfx
Replies

Spotware
28 Aug 2017, 12:28

Dear bdfx,

Thanks for reporting this to us. We have forwarded the issue to the product teams of cTrader and cTrader Web to investigate why there is a discrepancy between the values of the two applications. We will keep you updated.

Regarding cAlgo, is it possible to get a sample cBot that reproduces the problem so that we can check that as well?

Best Regards,

cTrader Team


@Spotware

bdfx
29 Aug 2017, 23:25

RE: CCI indicator readings off

Spotware said:

Dear bdfx,

Thanks for reporting this to us. We have forwarded the issue to the product teams of cTrader and cTrader Web to investigate why there is a discrepancy between the values of the two applications. We will keep you updated.

Regarding cAlgo, is it possible to get a sample cBot that reproduces the problem so that we can check that as well?

Best Regards,

cTrader Team

CTrader Team,

That file was overwritten, however the code was very simple: a reading of the cci index taken only at OnBar(), LastValue, as in the code snippet above. OnTick() was not included in the code.

bdfx


@bdfx