help easy language

strel

Newbie
Messages
2
Likes
0
I have got indicator (testindicator) and function (testfunction).
testindicator
Code:
vars: var1(0), var2(0);
var1 = testfunction(1);
var2 = testfunction(var1);
print(var1, var2);
testfunction
Code:
input: test(numeric);
vars: var1(test);
var1=var1+1;
Print("---", var1);
testfunction = var1;
printlog
Code:
---   2.00
---   3.00
   2.00   3.00
---   3.00
---   4.00
   3.00   4.00
---   4.00
---   5.00
   4.00   5.00
all right, but if use this script
Code:
vars: var1(0), var2(0);
if(false)then
begin
	var1 = testfunction(1);
	var2 = testfunction(var1);
end;
print(var1, var2);
print log
Code:
  0.00   0.00
---   2.00
---   1.00
   0.00   0.00
---   3.00
---   2.00
   0.00   0.00
---   4.00
---   3.00
   0.00   0.00
---   5.00
---   4.00
   0.00   0.00
why this function always used?
How this function get data?
 
You have a calculation involved which uses the value of a previous calculation as a part of its current calculation process. This makes the function a series function and for it to be able to work it will have to run on every bar. This means that regardless of how you try to encapsulate the function within boolean restrictions it will still get called on every bar of the chart.
 
Top