This is indicator:

Code: Select all

`inputs: calcMode(0), dataSeries1(1), dataSeries2(2); `

vars: xSeries(0), ySeries(0), calc(0);

xSeries = Close of data(dataSeries1);

ySeries = Close of data(dataSeries2);

if calcMode = 1 then

calc = fun(calcMode,xSeries,ySeries)

else if calcMode = 2 then

calc = fun(calcMode,xSeries,ySeries)

else if calcMode = 3 then

calc = fun(calcMode,xSeries,ySeries)

else if calcMode = 4 then

calc = fun(calcMode,xSeries,ySeries)

else if calcMode = 5 then

calc = fun(calcMode,xSeries,ySeries)

else if calcMode = 6 then

calc = fun(calcMode,xSeries,ySeries)

else if calcMode = 7 then

calc = fun(calcMode,xSeries,ySeries)

else if calcMode = 8 then

calc = fun(calcMode,xSeries,ySeries);

if LastBarOnChart then

Print(ELDateToString(date),", fun ... calcMode: ",calcMode,", calc: ",calc);

Plot3(calc,"calcolo");

Code: Select all

`inputs: calcMode(numericsimple), xSeries(numericseries), ySeries(numericseries);`

vars: double supVal(0.0), double infVal(0.0), value(0);

supVal = xSeries;

infVal = ySeries;

If infVal[1] <> 0 then value = supVal/infVal[1];

if LastBarOnChart = true then Print("fun: calcMode: ",calcMode);

fun = value;

Code: Select all

`fun: calcMode: 4.00`

02/23/2018, switch_fun ... calcMode: 4.00, calc: 4.80

fun: calcMode: 4.00

fun: calcMode: 4.00

fun: calcMode: 4.00

fun: calcMode: 4.00

fun: calcMode: 4.00

fun: calcMode: 4.00

fun: calcMode: 4.00

**completely indifferent to the condition "if then else"**, then executes all the branches of the condition. Same effect also using switch construct.

I hope support can solve fastly.

Regards, Smarty