I have a little problem which I failed to resolve with arrays or boolean values.
I only want to reduce the following formula
value1 = IIf( L > X, 1, IIf( H < X, -1, 0));
(where X is a calculated value for a line for exp.) to only the last 1 or -1 results
in case the result is 0, but as several 0 can follow each other I can't juste
refer to the previous element. So how to proceed in this case ?
Thank you for answer(s).
Thank you very much for your answer.
I see well that this is prefectly logical and working well
for your exemple. But for some reason it juste doesn't want work
in my exemple which is the Kijunsen:
Thank you again, so far I understood the proceedings and it works well.
But now when I only want to duplicate this same procedure with
another indicator and then try to get the simple addition of both results
I fail again and get 2 empty columns, only the initial column works.
That's quite nerf racking, I wonder what I missed this time .
First of all recent_nonzero_ES and recent_nonzero_5 are not empty but do return zero.
Secondly recent_nonzero never becomes zero and value4 almost never becomes zero and value5 never becomes zero because of recent_nonzero never returning zero.
You can come to conclusions yourself easily.
You just try to go easy route because of being impatient (been proven by e.g. creating duplicate threads).
Thank you again for your answer, unfortunately the 2. and 3. columns
remain empty even if replace the recent_nonzero_ES simply with value4.
Btw. I don't think I would have these problems on filling an Excel spreadsheet
with those columns to get these 1, -1 and 0 for the 2 indicators and add them,
I think I could do this easily, but with afl it's not so obvious apparently...
I see, may be it's because I apply actually this code on a 5 min chart
which only has around 20 days daily history. This was in fact also
my hopefully last question in this contexte , how to change the timeframe
of the exploration.
May be also I make an error by applying the application, as I apply it
always in the AFL Formula Editor. I never used exploration before
and I didin't find the way to open it from the chart.
OK, I found the solution changing my settings for Analysis and now
the results indeed correspond to my chart in what concerns the timeframe.
Nevertheless it still doesn't work the way I would like to see it, as
the columns 2 and 3 are just filled with 0, what should not happen.
Here my code
You once again do same mistake and post (almost) same code as before in post 5.
Why??
Why using iif(value4 == 0,..) if value4 never becomes nonzero?
Why using iif(value5 == 0,...) if value5 never becomes nonzero?
Why using multiple times Filter=1;?
Why not putting a bit better structure into code... IPO (input-processing-output)?
Please re-read my post!
Also it looks as if you still have not read here
You can come to conclusions yourself easily.
Have you checked value4 and value5?
I guess answer is "No".
OK, thank you very much for your patience !
Finally I got it right now, I thought I needed repeat the same
like for the 1. item, that's why I stuck there.
So this code works correctly now