Indicator Question

Posted By: flomo

Indicator Question - 11/18/15 15:43

Hello,

I am attempting to convert an indicator built in pine-script (Tradingview) into C-Lite. However, currently facing some errors, would be great if anyone could assist!

Indicator link: https://www.tradingview.com/v/pT7lglYP/

Below is my C-Lite coding attempt.

var T3_CCI()
{

var b = 0.618;
var Threshold = 0;
var b2 = b*b;
var b3 = b2*b;
var c1 = -b3;
var c2 = (3*(b2 + b3));
var c3 = -3*(2*b2 + b + b3);
var c4 = (1 + 3*b + b3 +3*b2);
var nr = 1 + 0.5*(5 - 1);
var w1 = 2 / (nr + 1);
var w2 = 1 - w1;

var xcci = CCI(14);
vars e1=series(), e2=series(), e3=series(), e4=series(), e5=series(), e6=series();
e1 = w1*xcci + w2*e1[1];
e2 = w1*e1 + w2*e2[1];
e3 = w1*e2 + w2*e3[1];
e4 = w1*e3 + w2*e4[1];
e5 = w1*e4 + w2*e5[1];
e6 = w1*e5 + w2*e6[1];

return c1*e6 + c2*e5 + c3*e4 + c4*e3;

}

Thanks!
Posted By: Petra

Re: Indicator Question - 11/18/15 17:17

You have defined the "e1" etc. as series, so it's e1[0] when you want the last element of the array. e2[0] = w1*e1[0] + w2*e2[1];, etc.
Posted By: flomo

Re: Indicator Question - 11/20/15 03:33

Thank you!
Posted By: Sphin

CrossOver/CrossUnder problems with exact match of the border - 11/22/15 02:22

Playing with this indicator I accidently found a fact that is revealed in the attached picture. Zorro apparently has a problem to recognize a CrossOver/CrossUnder if there is a value of exactly the border (here: 0) in between which is the case within the magenta circles in the T3_CCI window.

Attached picture Zorro_CrossX_Problem.jpg
Posted By: Sphin

Re: CrossOver/CrossUnder problems with exact match of the border - 11/22/15 14:22

I guess I know where the problem is. Zorro cannot know at the moment the value matches the border if the next value is under or over the border, but this is decisive for facing a crossing or a 'pull back' (see picture: the first circle depicts a crossing, the second a pull back; in both situations the value matches exactly the border). I must admit that I don't have a solution for this, maybe in case of a crossing the next bar after the match of the border can be set vicarious as the crossing point? To neglect the crossing completely seems not so good because it is often a point where some action should take place. Better later than never?

Attached picture Zorro_CrossX_Problem_II.jpg
Posted By: GPEngine

Re: CrossOver/CrossUnder problems with exact match of the border - 11/23/15 02:15

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Main=53376&Number=444528#top "peak() is baffled by flat-topped peaks. also affects crossover/u"
Posted By: Sphin

Re: CrossOver/CrossUnder problems with exact match of the border - 11/23/15 18:15

This was the thread I was searching for, I remembered that there was one but I could not find it. Thanks. It might be more reliable to write own code for those tasks than to miss signals in critical moments.
Posted By: sw1800

Re: CrossOver/CrossUnder problems with exact match of the border - 11/19/16 04:46

I am wondering if this issue has been fixed in the new versions ?
© 2024 lite-C Forums