how to get last candle id of an customindicators value != 0 ?
-
hey guys me again,
this time i try to figure out how i can get the last candle id from an custom indicators buffer was not empty (0)?
i know i could bring up 400-500 conditions that search for the last candle id, but i think there should be a quicker way?
any suggestions are very welcome
thx guys -
look through my post where I am refering how to work with Loop block ...
-
if you are referring to this post:
i know how to get the same result faster:

I am looking for an easy way to get the last candle id when an indicators buffer wasn't empty or zero. my easiest way i could think of is the following, but im not sure if it isnt to slow and how to stop the loop after the first candle id that meets the condition (buffer value != 0)
-
yes that is true, thanks for notice, I have not seen it before, ... but you can not get values which are not in list (for this you need to ask admin if he will add new functions here) ... it was only example which can be modified into many forms (for non list values)
note, that 0 is not always empty value (in metatrader) ... becuase default empty value for metatrader buffers is big integer number, or as EMPTY_VALUE ... but I think it can be set in indicator for another value using function SetIndexEmptyValue ...
https://docs.mql4.com/constants/namedconstants/otherconstantsthis my next example show you nearest stochastic Candle ID which value is above 50 (count starts when current stochastic is below 50) ....
I dont have your indicator so I can not give you specific example for your problem ... but I am sure you can do it
https://fxdreema.com/shared/6fcnY6k7
