# Recursives

Hi,

I have a question regarding the handling of recursives in the script editor.

As far as I am informed, the script editor can currently handling only two recursives in one code line. Is there a possibility that the script editor can handle up to four recurseves in one code line in the next six to twelve months?

Thanks

Thomas

Hi Thomas,

Can you give me an example of what you are trying to do?

Because of the Vector processing, recursives are very difficult. Regardless, I’m not aware of any limitations. The system we built should handle more than one.

All the best

Mathew

Hi Mathew,

this issue has already a long story.

To make this long story short the script is the following:

BARS1=21;
BARS2=17;

var1 = (1-(SIN((23.14159) / BARS1))) / (COS((23.14159) / BARS1));
var2 = IF(var2[1] <> 0, (0.5 * (1 + var1) * (Close() - Close(1) )) + (var1 * var2[1]), var1);
var3 = EXP(((1.414*-1) *3.14159) / BARS2);
var4 = 2 * var3 * (COS((1.414 * 3.14259) / BARS2));
var5 = (var3 * -1) * var3;
var6 = 1 - var4 - var5;
var7 = (var6 * ((var2 + var2[1]) / 2)) + (var4 * var7[1]) + (var5 * var7[2]);
var7

// var7 = (var6 * ((var2 + var2[1]) / 2));
// this first part of the code line is working

// (var4 * var7[1]) + (var5 * var7[2])
// the second part of the code line is not working

The problem is var7. It has three recursives and the result is wrong. Although the syntax of var7 is correct the result is wrong.

If I use as var7 the following first part:

var7 = (var6 * ((var2 + var2[1]) / 2));

the script results are correct.

But the second part of var7 – (var4 * var7[1]) + (var5 * var7[2]) – with two further recursives doesn’t work. It seems Optuma ignores the second part of var7 completely.

I have send Henry my Excel sheet with my calculations so we can say for sure that until the first part of var7 the script is working correct.

The links of the past post are the following:

https://help.optuma.com/tickets.php?id=35889

https://help.optuma.com/tickets.php?id=32286

https://forum.optuma.com/topic/enter-parameters

https://forum.optuma.com/topic/recursives

Last but not least this indicator is from John Ehlers and described in his book “Cycle Analytics for Traders”. In chapter 12 with the title “The Even Better Sinewave Indicator” pages 159-164 he lists the TradeStation code of the indicator. I have “recreated” the TradeStation code in Excel but now want create the code in Optuma. My Excel calculations are correct.

The corresponding TradeStation code to var7 is:

Filt = c1*(HP + HP[1]) / 2 + c2Filt[1] + c3Filt[2];

Many thanks

Thomas

Let me take a couple days to look into this. If the tool is available for us to add, I may just do that instead. A native tool will be a lot faster than this script.

I’ll let you know how we go.