Count the number of bars of indicator I_XO_A_H
-
Hi, please need support.
I use I_XO_A_H indicator in a EA, it have 2 buffers, one for green bar and one for red bar. The buffers value output are multiples of 1 (1,2,3,4,5...etc for green) or -1 (-1,-2,-3,-4, ...etc for red). The value define the amplitude of bars.
I need of a variable, formula or something "TO COUNT THE Nº OF BAR WITH X VALUE ...
http://screencast.com/t/Ci2d6os0
http://screencast.com/t/Ci2d6os0In this case, at moment of signal I need to count the last nº of bar with buffer value 8. (in this case are 11).
I need it to use a filter to get off the entry. For example: IF THE Nº of LAST BAR VALUE 8 ARE < 20 - THEN - DO NOT OPEN TRADE
How can I do it?
Thanks, regards! -
Unfortunately the EA builder is weak when it comes to mathematical calculations, this thing is normally done by the indicators themselves.
It's easier to write such a custom code instead of building it with blocks, because this some normal "for" or "while" loop with few extra variables to control it. I don't know how to make things like this with blocks... I mean... there are already some loops available (for example this big category with pink blocks), but many people have problems understanding how to deal with this, even if it's not that complicated.
Otherwise in some loop you want to check indicator values for the last candles, having some variable to count and starting from 0. When the detected value is lower/bigger than something - break the loop. Then use the value from the counter. Additionaly, to optimize things, add some "once per bar" functionality. Or something else.