Tomasz
April 17, 2018, 11:37pm
14
This has been covered on this forum multiple times. Really searching the forum reveals that most "problems" are already answered. So please use Search facility.
You will find answers QUICKER than when you asking the same questions again.
@twin - highly recommended reading:
http://www.amibroker.com/guide/a_mistakes.html
and
As mentioned by @fxshrat in ValueWhen - how to use a typical mistake users make is that they mix up if statement with IIf() function.
IIf() (which stands for "immediate if") is a function, which means it takes arguments and returns the result
result = IIf( condition, YesValue, NoValue );
It works with both numbers (scalars) and arrays. When any of arguments is an array it returns array. It goes bar by bar, checks condition again bar by bar and returns either corresponding array value from Yes…
and
http://www.amibroker.com/guide/errors/6.html
and
http://www.amibroker.com/guide/h_understandafl.html
and When scalar becomes an array, aka. type coercion in AFL
1 Like